So I'm tryna make a jojo game and finally for the love of god made quotes working, so now I made multiple and put them all in a data table and used the math.random function to randomly make them play each time the remote event is fired. However, sometimes the remote event fires but the quote and sound doesn't play. It's weird and I don't know why it's happening. Here's the scripts.
Client script =
local player = game.Players.LocalPlayer -- our player
local userinputservice = game:GetService("UserInputService")
local enabled = false -- begone spam
local Quote = script.Parent:WaitForChild("Quote")
userinputservice.InputBegan:Connect(function(Input, GPE)
if not GPE then
if Input.KeyCode == Enum.KeyCode.N and enabled == false then
enabled = true
Quote:FireServer()
wait(7)
enabled = false
end
end
end)
Server script =
local remote = script.Parent:WaitForChild("Quote")
remote.OnServerEvent:Connect(function(player)
print("large joe")
if math.random(1,3) == 1 then
local Billboard = script:WaitForChild("BillboardGui"):Clone()
local sound = Billboard.Sound
Billboard.Parent = player.Character.Head
sound:Play()
wait(6.5)
Billboard:Destroy()
elseif math.random(1,3) == 2 then
print("joe larg")
local Billboard2 = script:WaitForChild("BillboardGui2"):Clone()
local Sound = Billboard2.Sound
Billboard2.Parent = player.Character.Head
Sound:Play()
wait(6.5)
Billboard2:Destroy()
elseif math.random(1,3) == 3 then
local Billboard3 = script:WaitForChild("BillboardGui3"):Clone()
local Sound = Billboard3.Sound
Billboard3.Parent = player.Character.Head
Sound:Play()
wait(5.2)
Sound:Stop()
wait(1.5)
Billboard3:Destroy()
end
end)
(btw these were put in StarterPack)
Is there anyway I can fix this?

3 comments
The reason is because on line 12,20 and 5, the math.random changes for each elseif, store math.random in a variable so it doesnt pick a new random number each time.
I tried that but now it just keeps on doing the same quote over and over again. It's not doing it randomly like it's supposed to.
You still have to store the result inside the function, so that it changes every time