local RS = game:GetService("ReplicatedStorage")
local TP = RS:WaitForChild("TP")
TP.OnServerEvent:Connect(function(player)
print("Server received teleport request from:", player.Name)
local character = player.Character
if character then
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
hrp.CFrame = CFrame.new(Vector3.new(60.4, 0.5, 38))
print("Teleported", player.Name)
else
warn("No HumanoidRootPart for", player.Name)
end
else
warn("No character for", player.Name)
end
end)
-- this is local script
-- this is server script
local RS = game:GetService("ReplicatedStorage")
local TP = RS:WaitForChild("TP")
TP.OnServerEvent:Connect(function(player)
print("Server received teleport request from:", player.Name)
local character = player.Character
if character then
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
hrp.CFrame = CFrame.new(Vector3.new(60.4, 0.5, 38))
end
end
end)
server script is in SSS and local script is in a frame inside a screengui inside startergui