This is my code, line 13, or " local ChosenNumber = math.Random(0,10)" errors, attempted to call nil value. I'm not sure how to fix this because I have never used math.random, have a misplaced a character? (and yes this is in a respawning script)
Dummy = script.Parent.Parent.Dummy Clone = Dummy:Clone() function Regen() wait(3) Dummy.Parent = nil Clone.Parent = script.Parent.Parent Dummy = Clone Dummy:makeJoints() Dummy.Torso.CFrame = script.Parent.CFrame + Vector3.new(0,2.7,0) Clone = Dummy:Clone() local ChosenNumber = math.Random(0,10) if ChosenNumber == 10 then local clonedsword = game.ReplicatedStorage.Library["Steel Greatsword"]:Clone() clonedsword.Parent = game.Players.LocalPlayer.Backpack end Dummy.Humanoid.Died:connect(Regen) end Dummy.Humanoid.Died:connect(Regen)
It might be because random is capitalized, try doing this (its more condensed as well)
if math.random(0, 10) == 10 then -- Your code here end