#cframes in tables

10 messages · Page 1 of 1 (latest)

glad meadow
#
local rs = game.ReplicatedStorage
local target = nil
local positions = {
    ["indicatorFront"] = CFrame.new(0,0,-target.Size.Z/2),
    ["indicatorBottom"] = CFrame.new(0,-target.Size.Y/2,0),
    ["indicatorLeft"] = CFrame.new(-target.Size.X/2,0,0),
    ["indicatorBack"] = CFrame.new(0,0,target.Size.Z/2),
    ["indicatorTop"] = CFrame.new(0,target.Size.Y/2,0),
    ["indicatorRight"] = CFrame.new(target.Size.X/2,0,0),
    }
game["Run Service"].RenderStepped:Connect(function()
    target = game.Players.LocalPlayer:GetMouse().Target
    if target then
        if (game.Players.LocalPlayer.Character.Head.Position-target.Position).Magnitude < 15 then
            if target:GetAttribute("grab") then
                if target:GetAttribute("grab") == true then
                    if not target:FindFirstChild("highlight") and not target:FindFirstChild("indicatorFront") then
                        rs.highlight:Clone().Parent=target
                        for i,v in pairs(positions) do
                            local indicator = rs.indicator:Clone()
                            indicator.Parent = target
                            indicator.CFrame = target.CFrame * v
                            local weld = Instance.new("Weld")
                            weld.Parent = indicator
                            weld.Part0 = target
                            weld.Part1    = indicator
                        end
                    end
                end
            end
        end
    end
end)
frigid junco
#

use prints to debug and handle ur if statements better to avoid this

glad meadow
#

that part works. the part that isnt working is the line 3-10 and 22

sick fractalBOT
#

studio** You are now Level 1! **studio

frigid junco
#

whats the error

glad meadow
frigid junco
#

its bc target is nil

#

as u defined it

#

you'll have to define positions under the if target then for it to work

glad meadow
#

thank you