I am VERY NEW to scripting and I am trying to make a script that kills the localplayer if the value is under .2 using math.random(1). i tried multiple times with no success. pls help thx
script.Parent.MouseButton1Click:connect(function()
math.random(1)
if math <0.2
then
game.Workspace.LocalPlayer:BreakJoints()
function Break(Player)
Player.Character:BreakJoints()
end
end
end)
Thanks in advance!

8 comments
And you were checking in workspace for the localplayer
Hi, math.random only returns integer values. Your answer is correct, though, but I suggest just doing math.random(100) then checking if the value is less than the percentage you'd like, in this case, 20.
Good job, though!
Thank you alot, both of you! How do I choose that i have the answer tho?
if you want a number between 0 and 1, just use math.random() without any parameters
You can now just check for the value as It'll be already random. " if number < 20 then " then you just do whatever you were going to do with it being random.
@theking48989987 damn, didn't know that, thanks!
Oh, right, I forgot they only return integers