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

How would I make it, if you touch a brick, it teleports you to somewhere else, in the map?

Asked by 6 years ago
Edited 6 years ago

So like, a maze somewhat, when you touch a brick you get teleported. this is all I can come up with.

function onTouch(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    player:CFrame(0, 0, 0) --That is what I'm going to use as it for now.
end

Thanks! :)

1 answer

Log in to vote
0
Answered by 6 years ago

You almost have it.

function onTouch(hit)
    if hit.Parent.Humanoid then
         hit.Parent.PrimaryPart.CFrame = CFrame.new(0,0,0)
    end
end

Basically, you check to make sure that what hit you is indeed a player by making sure they have the "Humanoid" component in the correct place, then modify the main CFrame of the character model.

0
Ahh, thank you! ZAZC_Noob 7 — 6y
Ad

Answer this question