Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My in pairs loop doesn't work in my kick player script. Help?

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.

2 answers

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.