He is my code (Yes, the parenting is correct)
Torso = script.Parent.Parent.Parent.Parent.Torso.Position
Torso.Changed:connect(function() -- Error, changed is not a valid member of
script.Parent.Value = CFrame(Torso)
end)
He is my code (Yes, the parenting is correct)
Torso = script.Parent.Parent.Parent.Parent.Torso.Position
Torso.Changed:connect(function() -- Error, changed is not a valid member of
script.Parent.Value = CFrame(Torso)
end)
Position is a Vector3 class and not a game object, so it does not have events.
If you want something that always knows what the Torso's position is, use the Torso, and access its Position.
To fix this, you simply need to get the position correctly. Your problem is that you're trying to set the CFrame of the Value, which doesn't exist. Also, you need to just use the Torso changing to find if it has moved. We can do this by using the Changed event, and finding the property that changed.
We'll fix it like so:
Torso = script.Parent.Parent.Parent.Parent.Torso
Torso.Changed:connect(function(Property) -- Error, changed is not a valid member of
if Property=="Position" then
script.Parent.Value = Torso.Position
end
end)
Just a couple simple mistakes you made, that's all.
Anyways, if you have any further problems/questions, please leave a comment below, and I'll see what I can do. Hope I helped :P
####-Dyler3
How about this:
local torso = script.Parent.Parent.Parent.Parent.Torso
local posVal = script.PositionValue (Vector3 value)
while true do
wait()
if torso.Position ~= posVal.Value then
posVal.Value = torso.Position
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
On line 1 you are already doing Position, so on line 4 you are doing Torso.Position.Position?
No, I updated it. I already caught that. Thanks for pointing it out though
Doesn't work, sorry
Where is the script located?