I was using the Proximity Prompt to teleport players to a location, but it seems like the Proximity Prompt wasn’t working.
Here is my current script
local Prompt = script.Parent:WaitForChild("ProximityPrompt")
local db = false
local dbwait = 3.5
Prompt.Triggered:Connect(function(Player)
if game.Players:GetPlayerFromCharacter(Player.Parent) and db == false then
local Root = Player.Parent:FindFirstChild("HumanoidRootPart")
Root.CFrame = CFrame.new(workspace.FromTele.Position)
db = true
wait(dbwait)
db = false
end
end)
Note: “FromTele” is the part that I want players to teleport to.
When I go to test it and try to use in the the Proximity Prompt, nothing pops up in the output, no line saying there is an error. I’ve looked at multiple Proximity Prompt tutorials and they are all from months ago, has something changed with enabling Proximity Prompt?
Triggered passes the Player that triggered the prompt. Player.Parent always points to game.Players. You already have the player so there’s no need to try to find it again via GetPlayerFromCharacter
Player is the player inside of the players section in the explorer so you cannot get the humanoidrootpart with this method you should use player.Character:FindFirstChild("HumanoidRootPart")
You want to replace the line local Root = Player.Parent:FindFirstChild("HumanoidRootPart")
with local Root = Player.Character:FindFirstChild("HumanoidRootPart")
and also get rid of the game.Players:GetPlayerFromCharacter(Player.Parent) and
from if game.Players:GetPlayerFromCharacter(Player.Parent) and db == false then