Hey, i have a script for the round system, and the main game, (my script is a russian roulette-styled game), there is no errors, but it dosent work.
The script is located inside a textlabel (is a localscript).
The complete code:
local bullets = {"blank", "blank", "blank", "blank", "blank", "live"}
local blanks = 0
local m = game.Players.LocalPlayer:GetMouse()
local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local livel = 1
local canRoll = true
local canclick = false
local p = game.Players.LocalPlayer
local db = true
local yturn = false
local int = true
local plrs = game.Players:GetChildren()
local selectedp = plrs[math.random(1, #plrs)]
local gui = script.Parent
local intVal = 10
while true do
wait(0.000001)
for i,v in pairs(workspace.Players:GetChildren()) do
if v:FindFirstChild("Humanoid").Health <= 0 then
v.Parent = workspace.DeadPlayers
end
end
end
while true do
wait(0.000001)
for i,v in pairs(workspace.Players:GetChildren()) do
if v:FindFirstChild("Humanoid").Health <= 0 then
v.Parent = workspace.DeadPlayers
end
end
end
script.Parent.Text = selectedp.Name.." Gets the gun."
if selectedp.Name == game.Players.LocalPlayer.Name then
yturn = true
else
yturn = false
end
if int then
repeat
wait()
intVal -= 1
gui.Text = "Intermission "..intVal.."..."
until intVal == 0
wait(10)
gui.Text = "Game starting..."
wait(5)
db = false
end
local function shoot()
wait(3)
local sb = math.random(1, #bullets)
print(sb)
if sb == 6 then
print("Live")
livel -= 1
script.Parent.Text = "There was a bullet, bad luck... There is "..livel.." Bullets left."
hum.Health = 0
else
blanks += 1
print("Blank")
script.Parent.Text = p.Name.." are lucky... There is "..livel.." Bullets left."
end
if blanks == 5 then
sb = 6
end
local function roll()
sb = math.random(1, #bullets)
script.Parent.Text = (p.Name.." rolled the barrel.")
end
m.Button2Up:Connect(function()
canRoll = false
roll()
end)
end
local function click()
local shootval = 0
shoot()
shootval = shootval + 1
print("Shooted "..shootval.." Times.")
end
m.Button1Up:Connect(function()
if canclick and yturn == true and db == false then
db = true
script.Parent.Text = game.Players.LocalPlayer.Name.." Shoot the gun..."
print("Shooted")
click()
wait(5)
db = false
else
canclick = true
end
end)
local alive = workspace.Players:GetChildren()
if #alive == 1 then
gui.Text = "You are lucky, "..alive[1].Name.."..."
wait(5)
int = true
alive[1].Character.Humanoid.Health = 0
end
hum.Died:Connect(function()
canRoll = true
end)