I want to have a working RNG Asteroid Giver Once a Player Survives a Map.
This script below does not give asteroids.
I tried asking people on the forum, I have no errors at all so I have no idea what is wrong.
Heres the code below:
game.ReplicatedStorage.Game.OnPlayerSurvived.OnServerEvent:Connect(function(player, argument)
for _, Child in pairs(game.Workspace.Multiplayer:GetChildren()) do
if Child:IsA("Model") then
if game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 1 then
player.leaderstats.Asteroids.Value += math.random(1,5)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 2 then
player.leaderstats.Asteroids.Value += math.random(3,10)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 3 then
player.leaderstats.Asteroids.Value += math.random(6,15)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 4 then
player.leaderstats.Asteroids.Value += math.random(15,35)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 5 then
player.leaderstats.Asteroids.Value += math.random(25,50)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 6 then
player.leaderstats.Asteroids.Value += math.random(35,80)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 7 then
player.leaderstats.Asteroids.Value += math.random(75,135)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 8 then
player.leaderstats.Asteroids.Value += math.random(150,180)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 9 then
player.leaderstats.Asteroids.Value += math.random(200,265)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 10 then
player.leaderstats.Asteroids.Value += math.random(250,315)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 11 then
player.leaderstats.Asteroids.Value += math.random(335,450)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 12 then
player.leaderstats.Asteroids.Value += math.random(475,665)
elseif game.Workspace.Multiplayer:FindFirstChildOfClass("Model").Settings.Difficulty.Value == 13 then
player.leaderstats.Asteroids.Value += math.random(675,750)
end
else
warn("Player"..player.."has beaten a map but its not a valid difficulty or any map at all!")
end
end
end)