Hello, I’m trying to make a jumpscare when you click on the jumpscare button random images should appear when you press the button
For example: you press the button once, an entity appears as the jumpscare.
you press it again, it shows another entity.
Here’s the code that I’ve written:
local sound = game.Workspace.Scary
local images = script.Parent.Parent.Parent.scaryface.Folder:GetChildren()
local rand = Random.new()
local num = rand:NextInteger(1,#images)
local chosen = images[num]
local popup = script.Parent.Parent.Parent.scaryface.Image
local ready = false
script.Parent.MouseButton1Click:Connect(function()
if popup.Visible == false then
wait(0.1)
popup.Visible = true
sound:Play()
wait(2)
popup.Visible = false
end
end