So what ive done is ive tried making a code where it uses math.random to spawn items, and im trying to find out whats wrong with it but its not showing in the output
math.random(1,2) wait(2) if math.random = 1 then game.ReplicatedStorage.Square:Clone().Parent = workspace wait(2) if math.random = 2 then game.ReplicatedStorage.Triangle:Clone().Parent = workspace
Please help me fix it
You didn't set math.random(1,2)
equal to anything. So, for this, you would have to create a variable to reference the random number chosen.
local number = math.random(1,2)
You are also setting math.random to a number, you have to check it by comparing it.
local number = math.random(1,2) wait() if number == 1 then game.ReplicatedStorage.Square:Clone().Parent = workspace elseif number == 2 --// You don't need to do 2 if statements, you can just use else or elseif game.ReplicatedStorage.Triangle:Clone().Parent = workspace end --// Need to use EOF's to close and end the function
You are also not using EOF's, AKA end
to end the function. This will throw an error.
You don't really need the wait's either.
Hope this helped!