Hello! I am trying to make a part that you touch to teleport you, it works in Roblox Studio, but in game, it doesn't teleport the player. Please, if you know any alternatives, or you know how to fix it, please tell me.
local CollisionPart = script.Parent
local pospart = game.Workspace.RockyPitstop.PosPart
local Debounce = false
CollisionPart.Touched:Connect(function(hit)
if not Debounce == true then
Debounce = true
print("Its working")
if hit.Parent:FindFirstChild("HumanoidRootPart") then
hit.Parent.HumanoidRootPart.Position = pospart.Position
wait(3)
Debounce = false
end
end
end)

2 comments
change position to CFrame
also add a "WaitForChild()" for your variables, scripts load before objects so that could also be an issue