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:

01Part = script.Parent
02 
03Part.Touched:Connect(function(hit)
04local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) -- this just checks if a player exists
05if player then
06    if hit.Name == "Left Leg" or hit.Name = "Right Leg" then
07        Part.Anchored = false
08    end
09end
10 
11end)
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.

1Part = script.Parent
2 
3Part.Touched:Connect(function(hit)
4If Part.Anchored == true then
5wait(1)
6Part.Anchored = false
7end)

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