Hello, I am making a Story game, The lobby is being built, but to save time, I decided to script it, I have no problems, until it dawned on me, that I cannot think of a way to show a BlackGui To a Table, when teleporting, the GUI Comes down, and it needs to be cloned, since it’s in ServerStorage, it needs to be put into the player’s who are in the Bus Table Player Guis’ However, I don’t want to show it to just one person, or Everyone in the game, just the players who are in the Bus Table…
Here is my script, the script needs to go where it says --This is where the black gui needs to come down
Here is my main script, I have a few others, for the timer, etc:
--Variables
local TeleportService = game:GetService('TeleportService')
local PlayersInBus = game.Workspace.HitBox1.PlayersInBus
local BusTable = {}
local Bus1 = game.Workspace.Bus1
local teleporting = false
--Call The TeleportService ReserveServer Function
code = TeleportService:ReserveServer(56314517)
--Functions
function OnTouched(hit)
local Debounce = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Parent:FindFirstChild('Humanoid') and teleporting == false then
local findPlayer = table.find(BusTable, player)
if findPlayer == nil then
local hum = player.Character.Humanoid
for _, seat in pairs(Bus1.Seats:GetChildren()) do
if seat.Occupant == nil then
hum.WalkSpeed = 0
hum.JumpPower = 0
PlayersInBus.Value = PlayersInBus.Value + 1
player.Character.HumanoidRootPart.CFrame = seat.CFrame
game.ReplicatedStorage.ShowUI1:FireClient(player)
table.insert(BusTable, player)
break
end
end
end
end
end
function RemovePlayer(Player)
Player:LoadCharacter()
local PlayerToRemove = table.find(BusTable, Player)
PlayersInBus.Value = PlayersInBus.Value - 1
table.remove(BusTable, PlayerToRemove)
end
script.Parent.Touched:Connect(OnTouched)
game.ReplicatedStorage.RemovePlayer1.OnServerEvent:Connect(RemovePlayer)
function PlayerLeft(Player)
local GetPlayer = table.find(BusTable, Player)
if GetPlayer ~= nil then
table.remove(BusTable, GetPlayer)
PlayersInBus.Value = PlayersInBus.Value - 1
print('Removed: '..Player.Name..' From the BusTable! They have left..')
end
end
game.Players.PlayerRemoving:Connect(PlayerLeft)
--loops
while true do
wait()
if game.Workspace.HitBox1.Teleporting.Value == true then
teleporting = true
--This is where the black gui needs to come down
TeleportService:TeleportToPrivateServer(56314517, code, BusTable)
wait(10)
teleporting = false
end
end
The local script in the Gui is this:
script.Parent.Frame.Position = UDim2.new(0,0,-1,0)
script.Parent.Frame:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.In, Enum.EasingStyle.Quad,1)
If you know how to do that, Please let me know!
Thank you!