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

This teleport script only works in a test world, and not live. Why is that?

Asked by 7 years ago

All of this code is located in a LocalScript in ReplicatedFirst.

player = game.Players.LocalPlayer
teleporter = game.Workspace.Projects.Enterance.Teleporter
torso = player.Character.Torso

--function (teleport to a brick)
function Teleport_to_room()

    --Plays a soundfile located in workspace        
    teleporter.Part.Teleport_sound:Play()   

    --Disables the button
    teleporter.Part.ClickDetector.MaxActivationDistance = 0
    wait(0.8)           

    --Teleports the user to the brick's location
    torso.CFrame = game.Workspace.Teleport_test.CFrame

    --activates the button  
    teleporter.Part.ClickDetector.MaxActivationDistance = 16


end

game.Workspace.Projects.Enterance.Teleporter.Part.ClickDetector.MouseClick:connect(Teleport_to_room)

Thanks for the help!

0
The problem is you're not waiting for things to load, like objects in workspace or the player's character. OldPalHappy 1477 — 7y
0
How would I go about fixing that? Hyperclux 65 — 7y

Answer this question