You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the countdown gui to appear every time a player gets in the submarine -
What is the issue? Include screenshots / videos if possible!
the first time a player gets in the submarine the gui appears but every other time it does not -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I don’t know what the problem is, and there are no errors, so I didn’t really look.
basically, it’s the Doors elevators, but they’re submarines instead of elevators.
everything works besides the gui getting cloned into the player’s PlayerGui the second time the player gets in the submarine.
the script:
local SubCount = script.Parent.BillBoardGuiPart.PlayersInSub
local GameID = 13034935080
local TeleportService = game:GetService("TeleportService")
local MinPlayerRequired = script.Parent.MinimumPlayersRequiredToStart
local SubName = script.Parent.NameOfSub
local PlayersInParty = {}
local ReadyToGo = script.Parent.ReadyToGo
SubCount.Changed:Connect(function(NewVar) ----- someone leave/joins
if SubCount.Value >= MinPlayerRequired.Value then ------ if enough players are playing then
for _,v in game.Players:GetChildren() do -------- look at all of the players
if v:FindFirstChild(SubName.Value).Value == true then --- find which sub they are in
table.insert(PlayersInParty,v) ---- add them to the players playing
ReadyToGo.Value = true --------- and start teleport seqince
else -------------------------- all players not in sub
if table.find(PlayersInParty,v) then --- if they are on the list
table.remove(PlayersInParty,v) --- they get removed
end
v:FindFirstChild(SubName.Value).Value = false --makes sure they are not in the sub
if v.PlayerGui:FindFirstChild("TeleportCountdown") then --- if they have the gui
v.PlayerGui:FindFirstChild("TeleportCountdown"):Destroy() -- it's destroyed
end
end
end
end
end)
ReadyToGo.Changed:Connect(function(NewVar) ----when everythings ready
if ReadyToGo.Value == true then --------------see above
for _,v in PlayersInParty do --------- everyone on the list
local Gui = game.ReplicatedStorage.Guis.TeleportCountdown:Clone() --- gets a
Gui.Parent = v.PlayerGui --------------------------------------------gui
if v:FindFirstChild(SubName.Value).Value == false then ---- if they change their minds
table.remove(PlayersInParty,v) ---------------------they are removed from the list
v.PlayerGui:FindFirstChild("TeleportCountdown"):Destroy() --- and the gui is destroyed
end
end
wait(10) --------- after 10 seconds
for _,v in PlayersInParty do ------ get all players on the list
if v:FindFirstChild(SubName.Value).Value == true then ---and they are sure
TeleportService:TeleportPartyAsync(13034935080, PlayersInParty) -- they teleport
else ---------------if they are unsure then
if v.PlayerGui:FindFirstChild("TeleportCountdown") then --the gui is destroyed
v.PlayerGui.TeleportCountdown:Destroy()----------------see above
end
end
end
end
end)
I’ve never really delt with teleporting and barely use tables but I’m pretty sure I did everything right, unfortunately I obviously did not because it doesn’t work lol.
sorry if this is a particularly stupid question, and thanks for helping!
unless you didn’t help