Can anyone point me in the direction of why this math.random script will only drop “crystals” and drops nothing if “shards” is selected? Is my syntax in, If then else incorrect?No errors in output.
print ("I died") wait() local crystal= game.ReplicatedStorage.Crystals:WaitForChild("Red") local shard= game.ReplicatedStorage.Crystals:WaitForChild("RedShard") local dropChance = 25 local droppedCrystal = nil local randomDrop = math.random(1,100) if randomDrop > dropChance then droppedCrystal=shard:Clone() else droppedCrystal = crystal:Clone() droppedCrystal.Parent = game.Workspace droppedCrystal.Position = monPos+Vector3.new(0,-4,0) local collectScript = game.ReplicatedStorage:FindFirstChild("Collect"):Clone() collectScript.Parent = droppedCrystal end
Side note, why have I been having problems defining a clones position before parenting it to workspace? I thought that was the better order but every time I try to parent after defining position it never seems to position correctly.
Thanks for any feedback!