Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't my code working but no error and it should be correct code?

Asked by 4 years ago

I am making a piggy inspired game from scratch will the help of my friend, and he is the builder. I am the programmer of the game, and I am having some difficulties in my system that detects if the game is over or not. If the timer runs out it is over. If everyone dies or leaves the game, the round is over. If the slayer dies or leaves the game, the round is over. The timer part works completely fine, but the other 2 options work and don’t work. They work very well if you are doing 1 player, but not that good when multiple players get selected. I have gone over my code a bunch of times, and I even tried making it double-check, and still nothing. Voting works fine, but this glitch only happens when a player is selected and not a bot. Here is my round system code:

001while true do
002    for i, v in pairs(game.Players:GetChildren()) do
003        v.Character.Humanoid.Health = v.Character.Humanoid.MaxHealth -- Makes sure the player's health is full
004    end
005    for i = 45, 0, -1 do
006        game.ReplicatedStorage.Status.Value = "<ContainerHorizontalAlignment=Center><AnimateStepFrequency=0>Intermission: <AnimateStyle=Fade><AnimateStyleTime=0.25><Color=Green>" .. i  -- I used rich text module made by defaultio
007        wait(1)
008    end
009    local slayer
010    local gameOver = false
011    local slayerLeft = false
012    local players = game.Players:GetChildren() -- a table listing all of the players that we will put into the round
013    local chosenMode = "Player"
014    local numPlayers = #game.Players:GetChildren() -- the number of players
015    for i, v in pairs(players) do -- Doesn't add the player to the round if they are still loading
View all 178 lines...

I just cannot figure out why it doesn’t work. I sometimes found that if a player dies it sometimes doesn’t do anything. Is the script not efficient or is it an error? I can’t seem to know!

0
nice code script milker. just tell us the line it stops on. lmao iuclds 720 — 4y
0
it doesn't stop. there are no errors but it still doesn't work MrTumbleWede 5 — 4y

Answer this question