Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix the problem I'm having with a CFrame Function?

Asked by 4 years ago

So here is what I have: function checkforblock(x,y) if workspace:FindFirstChild(x) == nil then local ree = Instance.new("Part", workspace) ree.Name = (x) ree.Anchored = true if workspace:FindFirstChild(y) == nil then local Y = Instance.new("Part", workspace) Y.Name = (y) Y.Anchored = true end end end

function position(x, y, z, a) local newCFrame = CFrame.new(x, y, z) local object = (a) object.CFrame = newCFrame end

checkforblock("Redblock","blueCube") position(0, 5, 0, "Redblock")

My mess up is in the third line of the position function. It gives me the error of ("Error attempt to index local 'object' (a string value)") I can't figure out why, Could I have some help please.

1 answer

Log in to vote
0
Answered by 4 years ago

the property of CFrame is Vector3 so it should be like Vector3.new()

Ad

Answer this question