Scrap your script. There's no point in using the .PlayerAdded or the .CharacterAdded events. They're redundant.
What you should be focusing on is the .Touched event.
TeleportBrick = script.Parent
function onTouched(hit)
end
TeleportBrick.Touched:connect(onTouched)
You should add some safeguards to ensure that the model that's touching the teleport part is the character of the Player instance itself, such as the :GetPlayerFromCharacter() and the :FindFirstChild() methods.
:GetPlayerFromCharacter(): Verifies if the character is connected to a player. If true, it will return the player instance. If false, it will return nil.
:FindFirstChild(): Verifies if the object exists, utilizing the string of the name. If true, it will return the object. If false, it will return nil.
local HumanoidIsFound = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
local PlayerIsFound = hit.Parent and game.Players:GetPlayerFromCharacter
if HumanoidIsFound and PlayerIsFound then
hit.Parent:MoveTo(214, 20, 119)
end
10 comments
Do you just need a teleportation brick?
im not sure, im completely new to this function
but im sure Vector3 should be fine
What does the error say?
it just shows the red line below, but theres nothing in the output
How about the Script Analysis pane?
oooh, nvm, i kept overlooking that GetPlayerFromCharacter is an event and needs () sorry for that
strange, it still doesnt work
Edit your question with the current script you have, please.
Yes, you need a server script to use Zyneak or my script.