Hello guys, I make question yesterday and MCAndRobloxUnited answered me. I tried the script by MCAndRobloxUnited At first it did not work but when I added "end" in line 10 it works with me, but when I published the game it doesn't work, It is only work in ROBLOX Studio. Please help me guys. this is the script I used by MCAndRobloxUnited:
function onTouched(hit)
print("Teleport")
local human = hit.Parent:FindFirstChild("HumanoidRootPart")
local brick = script.Parent
if game.Players.LocalPlayer.leaderstats.Stages.Value == 100 then
if (human ~= nil) then
human.CFrame= CFrame.new(Vector3.new(Position))
end
end
end
script.Parent.Touched:Connect(onTouched)

3 comments
You are awesome thanks a lot <3
you should have done local players = game:GetService("Players")
the service will load before the script does, doesn't matter