Replicated = game:GetService("ReplicatedStorage")
Player = game:GetService("Players").LocalPlayer
timesFQ = 0
timeYE = 0
timeSoNaund = 0
timesSoundPlayed = 0
human = nil
Player.Chatted:Connect(function(message: string)
local randomMusic = Replicated.Sounds:GetChildren()[math.random(1,# Replicated.Sounds:GetChildren())]
randomMusic:Play()
if Replicated.Sounds.YE.IsPlaying == true then
timeYE += 1
end
timesSoundPlayed += 1
if timeYE>=3 then
Replicated.Sounds:Destroy()
script:Destroy()
workspace["Music Box Alive"]:Play()
game.Lighting.ColorCorrection.Enabled = true
task.wait(10)
Player:Kick("Bad")
if Replicated.Sounds.FQ.IsPlaying == true then
timesFQ += 2
end
if timesFQ>=5 then
Replicated.Sounds:Destroy()
script:Destroy()
workspace["Music Box Alive"]:Play()
game.Lighting.ColorCorrection.Enabled = true
task.wait(5)
Player:Kick("Funny.")
if timeSoNaund>=3 then
Player:Kick()
end
if Replicated.Sounds.SoNAund:Play() then
timeSoNaund += 1
end
It only kicks âbadâ the other kick wonât work as itâs just this line who works. Any ways to fix this? I know this is a bit messy
If these are your variables, you need to put âlocalâ before them, like this:
local Replicated = game:GetService("ReplicatedStorage")
local Player = game:GetService("Players").LocalPlayer
local timesFQ = 0
local timeYE = 0
local timeSoNaund = 0
local timesSoundPlayed = 0
local human = nil
I have impoved the format slightly:
local Replicated = game:GetService("ReplicatedStorage")
local Player = game:GetService("Players").LocalPlayer
local timesFQ = 0
local timeYE = 0
local timeSoNaund = 0
local timesSoundPlayed = 0
local human = nil
Player.Chatted:Connect(function(message: string)
local randomMusic = Replicated.Sounds:GetChildren()[math.random(1,# Replicated.Sounds:GetChildren())]
randomMusic:Play()
end)
if Replicated.Sounds.YE.IsPlaying == true then
timeYE += 1
else
timesSoundPlayed += 1
end
if timesFQ>=5 then
Replicated.Sounds:Destroy()
script:Destroy()
workspace["Music Box Alive"]:Play()
game.Lighting.ColorCorrection.Enabled = true
task.wait(5)
Player:Kick("Funny.")
if timeSoNaund>=3 then
Player:Kick()
elseif timeYE>=3 then
Replicated.Sounds:Destroy()
script:Destroy()
game.Workspace["Music Box Alive"]:Play()
game.Lighting.ColorCorrection.Enabled = true
task.wait(10)
Player:Kick("Bad")
end
if Replicated.Sounds.FQ.IsPlaying == true then
timesFQ += 2
end
if Replicated.Sounds.SoNAund:Play() then
timeSoNaund += 1
end
end