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

Teleport all players, but it doesnt change gui for all players?

Asked by 8 years ago
local x = game.Workspace.tpReceive.Position.X 
local y = game.Workspace.tpReceive.Position.Y
local z = game.Workspace.tpReceive.Position.Z

function onTouched(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        local winnerGui = player.PlayerGui.WinnerStatusGui.WSFrame.WSText
        local pointsGui = player.PlayerGui.PointsGui.PointsFrame.Points
        local number = tonumber(pointsGui.Text)
        if number == nil then number = 0
        end
        number = number + 1
        pointsGui.Text = number
        for i, object in pairs(game.Players:GetChildren()) do
            if object:FindFirstChild("PlayerGui") then
                local pg = object:FindFirstChild("PlayerGui") 
                local winner = pg.WinnerStatusGui.WSFrame.WSText
                winner.Text = hit.Parent.Name.." has prevailed!"
        for i, object in pairs (game.Workspace:GetChildren()) do
            if object:FindFirstChild("Torso") then
                local torso = object:FindFirstChild("Torso") 
                torso.CFrame = CFrame.new(x, y, z)
                wait(5)
                winner.Text = "  "
            end
            end
            end
        end
    end
end

script.Parent.Touched:connect(onTouched)

There's the code (clearly) and the problem I'm having is that, I server tested it through studio with all the guests and stuff, and it seems to teleport players late, and give them late notifications, etc. I cant figure out why it would do this, could someone help me out? (Any other bugs found and fixed/explained would also be greatly appreciated!) Thanks :)

1 answer

Log in to vote
1
Answered by
brianush1 235 Moderation Voter
8 years ago

In ROBLOX Studio, if you do not have focus on a window, the FPS is dropped from maximum to about 20 FPS. It's probably just a visual glitch, however, it also doesn't communicate on your local PC, rather, it uses LAN. It may take some time to send a request to the server and get one back, which would be a teleporting or GUI request.

Basically, it's probably server lag. No reason to be anything else :)

0
Thank you :D that saves me a whole lot of time Squidier 40 — 8y
Ad

Answer this question