So here's my script
Var1 = math.random(1,3)
function clicked()
if Var1 == 1 then
Instance.new("Part",game.Workspace)
elseif Var1 == 2 then
Instance.new("TrussPart",game.Workspace)
elseif Var1 == 3 then
Instance.new("ParticleEmitter",game.Workspace)
else
print("Nothing has happen")
end
end
script.Parent.ClickDetector.MouseClick:Connect(clicked)
Whenever I start the "Play" I click the clickdetector and only spawns only one of the random 3 parts.. like if I started the game and then spammed clickdetector it would only do number 2 which would be TrussPart and another time when I press "Play" it would spawn number 1 which is Part.
How can I do it so whenever I press the Clickdetector it makes it so that it chooses 1,2 or 3 randomly instead of being stuck on one of the numbers.

3 comments
line 2 put math.randomseed()
It still doesn't work, and I've searched up how to use it but theres still no solutions e.e
Oh yeah the guy below in the answers is right, your random number is outside the event so it never changes, to fix it, put it in the function