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

Script doesnt teleport me to where I want to go. Teleports to random coordinate?

local rs = game:GetService("ReplicatedStorage")
local part = script.Parent
local isTouched = false
local oldCoords = script.Parent.Parent.OldCoord.Position
local newCoords = script.Parent.Parent.NewCoord.Value.Position
local teamplayers = game:GetService("Players")
part.Touched:Connect(function(plrwhotouch)
	if not isTouched then
			local playerobj  = teamplayers:FindFirstChild(plrwhotouch.Parent.Name)
		isTouched = true
		rs.Events.TeleportationToClient:FireClient(playerobj)
	end
end)
rs.Events.TeleportationToServer.OnServerEvent:Connect(function(player,root)
	root.Parent:MoveTo(Vector3.new(newCoords))
	rs.Events.TeleportationToClientSecond:FireClient(player)
	isTouched = false
end)

Does anyone know why? Thanks in advance

EDIT: Realized that it was the CFrames causing issues. Changed it to Vector3 Positions but still get the same problem.

1 answer

root.CFrame = newCoords

CFrame is not position, that's why you were teleported to a random spot. CFrame aka "CoordinateFrame" is position and rotation

1 comment

0

Changed everything to Positions, and I still get teleported to random spots.

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