1 | function Teleporter(hit) |
2 | if hit.Parent and hit.Parent:FindFirstChild( "Humanoid" ) then |
3 | hit.Parent:MoveTo(game.Workspace.SpawnLocation 2. Position + Vector 3. new( 0 , 5 , 0 )) |
4 |
5 | end |
6 | end |
7 |
8 | script.Parent.Touched:connect(Teleporter) |
This script works and all, but I was testing my Obby and well When I died, my body landed on the teleporter. And I got a error. So is there a way for the button not to run when you touch it with 0 health?
Yeah, In your if statement add a and hit.Parent.Humanoid.Health > 0 then