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

Help How Do i Make a Player die if they get the number 1?

i tried to fix this its like when u click a block it gives u a random number i tried for 2 hours trying to fix this but couldnt

script.Parent.ClickDetector.MouseClick:Connect(function(click)
	
	local imrandom = math.random(1,12)
	
	print(imrandom)
	function kil(player)
	if imrandom == 1 then
		
			local human = player.Character.Humanoid
				human.health = 0
				
			
end
	end
	
end)

and i inserted a click detector too

also just realised i lost the other code

1 answer

✓ Accepted answer

Here's a fixed version of your code. You have some deprecated practices like the use of health which is supposed to be Health. And a random function that is not needed.

Fixed Script

script.Parent.ClickDetector.MouseClick:Connect(function(click)

	local imrandom = math.random(1,12)
	print(imrandom)
		if imrandom == 1 then

			local human = click.Character.Humanoid
			human.Health = 0


		end
	end)

1 comment

0

thx

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