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

Step on to Unanchor a part?

Asked by 4 years ago

So i am trying to make a game where in a certain part the floor falls no disapear fall. this is what i currently have also i want this to not be in one client i want this to be for everyone.

Part = script.Parent

Part.Touched:Connect(function(hit)

Part.Anchored = false

end)

0
is it a local script? Raccoonyz 1092 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

If you want this to only work if a leg touches it then we can do as follows:

Part = script.Parent

Part.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) -- this just checks if a player exists
if player then 
    if hit.Name == "Left Leg" or hit.Name = "Right Leg" then
        Part.Anchored = false
    end
end

end)

Ad
Log in to vote
0
Answered by 4 years ago

Everything is good here, so I don't understand the problem. You could add a wait() if you want to give the players some time to get off. Also to reduce lag I would check if it is anchored already. Here is the improved script.

Part = script.Parent

Part.Touched:Connect(function(hit)
If Part.Anchored == true then
wait(1)
Part.Anchored = false
end)

Let me know what the problem is and I can help furthermore, have a good day!

0
This script is wrong JesseSong 3916 — 4y
0
Make sure you use if not If and you need to check whatever hits has a humanoid, lastly make your you reference player object and the parameter but JesseSong 3916 — 4y

Answer this question