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

How come it doesn't teleport me in server, but works in studio?

Asked by
MrHerkes 166
6 years ago
local player = game.Players.LocalPlayer
local character = player.Character
local textbutton = script.Parent
local stairspawn = game.Workspace.StairSpawn
textbutton.MouseButton1Click:Connect(function()
    local humanoidroot = character:FindFirstChild("HumanoidRootPart")
    if humanoidroot then
        character.HumanoidRootPart.CFrame = stairspawn.CFrame + Vector3.new(0,3,0)
    end
end)

This script is placed inside a TextButton and it's a LocalScript. If I click it, it will teleport me. However, it doesn't work on servers. Why?

1 answer

Log in to vote
0
Answered by 6 years ago

In game press "f9" to see what's happening. Probably your character didn't load quick enough before the script runs.

Ad

Answer this question