Log in to vote
0

My script in TeleportService Won't work?

Asked by 7 years ago

Hmm..... I want to make a Game (Not a place) with all places i have, but i can't. My code won't work, even that model can edit and got from a person. I tried all but.. won't work. Help me Guys What part of script is not working.

function onTouched(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        game:GetService("TeleportService"):Teleport(127345959, player)
    end
end

script.Parent.Touched:connect(onTouched)

2 answers

Log in to vote
1
Answered by 7 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
function onTouched(hit)
while true do
local play = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService("TeleportService"):Teleport(127345959,player)
end
end
script.Parent.Touched:connect(onTouched)
0
Oh thanks :D Neonridex 5 — 7y
0
but... can u make it a model in models and give it to me? i cant read scripts, dont know what spacing. Please :D Neonridex 5 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Are you sure the code it correct?

Answer this question