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

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

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

✓ Accepted answer

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 :)

1 comment

0

Thank you :D that saves me a whole lot of time

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