This script should send players to the towers and back to the lobby, yet it does not? (FIXED)
Asked by
4 years ago Edited 4 years ago
Can anyone even know what is wrong with my code? I have checked and have no idea why it is not working. It worked in the past but i modified some of it and its not doing what i want. (Also no errors in the output)
I have changed the code several times yet its still not working, there is a bug with the ROBLOX lua or there is a flaw I don't even know it was there.
This script was supposed to send players from the lobby to 3 towers randomly, when times is finished it sends them back to the lobby, but it does not. Also the status is also not changing. (or really?)
Anyways, I want to give a thousand hugs to that person who managed to fix this.
The script that updates the gui and most importantly, sends the player to the towers and sends them back when the time runs out:
02 | local intermissionLength = 100 |
03 | local inRound = game.ReplicatedStorage.inRound |
04 | local Status = game.ReplicatedStorage.Status |
06 | local TowerGenerator = math.random( 1 , 3 ) |
07 | local LobbySpawn = game.Workspace.Lobby.Floor.Center.SpawnLocation |
09 | local Normal = game.Workspace.Normal.Ground.Teleporter |
10 | local MoltenCave = game.Workspace.MoltenCave.Ground.Teleporter |
11 | local LavaFacility = game.Workspace.LavaFacility.Ground.Teleporter |
13 | inRound.Changed:Connect( function () |
14 | if inRound.Value = = true then |
15 | TowerGenerator = math.random( 1 , 3 ) |
16 | for _, player in pairs (game.Players:GetChildren()) do |
17 | local char = player.Character |
19 | if TowerGenerator = = 1 then |
20 | char.HumanoidRootPart.CFrame = Normal.CFrame |
21 | elseif TowerGenerator = = 2 then |
22 | char.HumanoidRootPart.CFrame = MoltenCave.CFrame |
24 | char.HumanoidRootPart.CFrame = LavaFacility.CFrame |
28 | for _, player in pairs (game.Players:GetChildren()) do |
29 | local char = player.Character |
30 | char.HumanoidRootPart.CFrame = LobbySpawn.CFrame |
35 | local function roundTimer() |
37 | for i = intermissionLength, 1 , 0 do |
40 | Status.Value = "Lobby" |
42 | for i = roundLength, 1 , - 1 do |
45 | Status.Value = "" ..i.. "s" |
And here is the script for the GUI for notifying players the status:
1 | local status = game.ReplicatedStorage.Status |
2 | local TimerDisplay = script.Parent.TimerDisplay |
4 | status.Changed:Connect( function () |
5 | TimerDisplay.Text = status.Value |
Anyways, thank you for reading this, it will make me improve my scripting skills.