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

Teleporting only works for one player?

LINE OF CODE:


local Part = game.Workspace.TPMePlox

Ready = true
Part.Touched:Connect(function(hit)
	local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if Player ~= nil then
		tele = game:GetService("TeleportService")
		gameID = 5791125484 
		if Player.leaderstats.Tickets.Value >=1 and Ready == true then
			Ready = false
			gui = script.Parent.TPmessage
			gui:Clone()
			gui.Parent = Player.PlayerGui
			Player.leaderstats.Tickets.Value = Player.leaderstats.Tickets.Value - 1
			tele:Teleport(gameID, Player)
			Ready = true
		end
	end
end)

Basically its designed to when a player WITH above or equal to 1 ticket steps on the part, it comes up with a GUI that says "teleporting..". Now, this works with 1 player but when the player teleports it won't work again. I want it to be able to support people just going in and teleporting at once. (The Ready = true or false being deleted does not make a difference)

2 comments

0

Does a error pop up when another player trys to teleport again?

0

I'm not sure, I haven't tried two people teleporting in studio (im not sure i can) but 1 person works with no error message

1 answer

One reason may be because you don't have enough tickets to teleport again. In your code you appear to reduce the amount of tickets in the player by 1. Therefore it may not run the conditional as the amount of tickets is less than one. One way around this would be to make it so you can gain tickets or something like that. I can't confirm this though as I have no idea how many tickets you've made available.

Hope this helps

1 comment

0

No, I gave myself 30 tickets

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