Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How does one get something to fire when the position is at a certain point?

1 answer

As gold said, for this you can use either :GetPropertyChangedSignal () or the Changed event, and I'm sure that you can just use an if statment that checks if part.Position is == to the position that you want. And to be honest i'd say that the best way (for me at least) to use the changed event. The paramater for this event, as guessed is the property that changed

local part = workspace.Part.  -- or wherever is your part

part.Changed:Connect(function(prop)
if prop == "Position" then -- we checked if the position was changed 
         if part.Position == Vector3.new(49, 59, 10) then -- then we checked if the position changed to the position we wanted
                    print(prop .. " changed to" .. tostring(part.Position))
                    -- and put what you want to be fired here
         end
end
end)

I'm aware that :GetPropertyChangedSignal() is more efficent but tbh i like it this way!

2 comments

0

Sorry if my answer is weird looking im wrote this on a phone, and if you're wondering whats tostring for its prety much a function that changes any value to a string. its really helpful but not a difference if youre printing

0

oh boi 2 upvotes ty

This discussion is preserved as it was. New answers, comments, and votes are closed.