Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Ahh, thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.