local part = script.Parent local player = game.Players:GetChildren() local debounce = false part.Touched:Connect(function(part) if debounce == false then debounce = true print("e") game.ReplicatedStorage.shoot.Playing = true for i, v in pairs(player) do print("ee") v.PlayerGui.Guiii.blackscreen.BackgroundTransparency = 0 wait(0.1) v:Kick("u lose haha") end end end)
It all works until the in pairs loop. It also doesn't play the sound before it. If you want to know anything else comment then I will respond.
Use Players:GetPlayers instead of Instance:GetChildren. Also, you need to call the function inside the event as the player
variable was set when the script started, and variables to not automatically update.
I would recommend changing line 8 from game.ReplicatedStorage.shoot.Playing = true
to game.ReplicatedStorage.shoot:Play()
as you said the code stopped working after that. Hope that not only plays the sound but fixes your problem!