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

Proximity Prompt stops working after 5-8 uses?

Asked by 3 years ago

So I have a proximity prompt on both sides of the door that teleport me on the other side after using the proximity prompt.

It works completely fine with no errors for about 5-8 times before it just stops working.

No errors or anything, the circle goes around the E completely but nothing happens. I have no idea why it stops working after a certain amount of uses.

local Tpin = script.Parent.TpInsideRoom
local Tpout = script.Parent.TpOutsideRoom

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        print("1")
        local humanoid = character.HumanoidRootPart
        print("2")
        script.Parent.inknob.ProximityPrompt.Triggered:Connect(function(player)
            print("3")
            humanoid.Position = Tpout.Position
            print("4")
        end)
    end)
end)



game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        print("5")
        local humanoid = character.HumanoidRootPart
        print("6")
        script.Parent.out.ProximityPrompt.Triggered:Connect(function(player)
            print("7")
            humanoid.Position = Tpin.Position
            print("8")
        end)
    end)
end)

1 answer

Log in to vote
0
Answered by 3 years ago

You should not have the Triggered events inside the PlayerAdded and CharacterAdded events. You can use the player parameter from the Triggered event to teleport the player.

0
Sorry im new to this, could you post the code, because now im getting errors that position is not a valid member of players.administrativefellow @Vong25 AdministrativeFellow 13 — 3y
0
You have to use the Character property of the player to get the player. Then, path to the HumanoidRootPart and set its position. COUNTYL1MITS 312 — 3y
Ad

Answer this question