Hello! My game is basically finished, I’ve made game passes, products, several maps and game modes, all that is left are a few touch-ups here and there. However, the main game script, which I have heavily tested, works perfectly in Studio, but when I play it in-game it just stops at the ‘(insert player name) blew up!’ No error in the console. I have recorded some proof to show you.
(Sorry in advance for lag!)
In Studio:
In-game:
Here is the part of the game script I notice it stops at, if that helps:
assets.ParentChanged.Event:Connect(function(parent)
potatoHolder = parent
ReplicatedStorage.Status.Value = potatoHolder.Name .. " has the potato!"
end)
assets.Exploded.Event:Connect(function(player)
if player then
ReplicatedStorage.Status.Value = player.Name .. " blew up!"
end
end)
while #getPlaying:Invoke() > 1 do
local randomPlayer = getPlaying:Invoke()[math.random(1, #getPlaying:Invoke())]
local potatoHolder = randomPlayer
ReplicatedStorage.Status.Value = potatoHolder.Name .. " has the potato!"
local potato = assets.Potato:Clone()
potato.Parent = randomPlayer.Character
while potato.Parent do task.wait() end
task.wait(1)
end
table.insert(module.Winners, getPlaying:Invoke()[1])
ReplicatedStorage.Status.Value = getPlaying:Invoke()[1].Name .. " didn't blow up!"
module.RunTime = tick() - gameStartTime
task.wait(1)
Any help is greatly appreciated!
Edit:
Okay so turns out my problems originate from this line, but every time I remove it or try to replace it with something else, it clones the potato every second.
Okay so turns out my problems originate from this line, but every time I remove it or try to replace it with something else, it clones the potato every second.
My guess is that you didn’t stop the while #getPlaying:Invoke() > 1 do function after it’s blew up so it’s a infinite loop
try this
assets.ParentChanged.Event:Connect(function(parent)
potatoHolder = parent
ReplicatedStorage.Status.Value = potatoHolder.Name .. " has the potato!"
end)
assets.Exploded.Event:Connect(function(player)
if player then
ReplicatedStorage.Status.Value = player.Name .. " blew up!"
end
end)
while #getPlaying:Invoke() > 1 do
local randomPlayer = getPlaying:Invoke()[math.random(1, #getPlaying:Invoke())]
local potatoHolder = randomPlayer
ReplicatedStorage.Status.Value = potatoHolder.Name .. " has the potato!"
local potato = assets.Potato:Clone()
potato.Parent = randomPlayer.Character
while potato.Parent do task.wait() end
task.wait(1)
break
end
table.insert(module.Winners, getPlaying:Invoke()[1])
ReplicatedStorage.Status.Value = getPlaying:Invoke()[1].Name .. " didn't blow up!"
module.RunTime = tick() - gameStartTime
task.wait(1)
okay from what I understand, the game continues until there is 1 player left?
and the problem is the script stops at while potato.Parent do task.wait() end ?
sorry i’m confused lol