Kick Player When Lives Run Out

local button = script.Parent
local otherButton = script.Parent.Parent.opt3Select

local heart1 = button.Parent.heart1
local heart2 = button.Parent.heart2

local Players = game.Players

local Lives = 2

local function RemoveLife()
	Lives -= 1
	if Lives == 1 then
		heart1.ImageColor3 = Color3.new(0, 0, 0)
	elseif Lives == 0 then
		heart2.ImageColor3 = Color3.new(0, 0, 0)
		print("Kicking the player")
		Players:GetPlayers()[1]:Kick("You ran out of lives")
	end
end

button.MouseButton1Click:Connect(function() 
	print("Clicked 1")
	RemoveLife()
end)
otherButton.MouseButton1Click:Connect(function()
	print("Clicked 2")
	RemoveLife()
end)

Is the second button only meant to be activated when the first one has already been clicked?

TYSM IT WORKS NOW!

TYSM IT WORKS NOW!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.