I'm currently making a game and I wanna make it so if you finish the promixity prompt a gui will appear and i want a chance to get 3 endings Good ending (49%), Bad ending (49%), and the secret ending (2%) the numbers are the rarity to each ending (duh) and I really want this to work commenting with a script would help alot!
COMMUNITY QUESTION
Heya! I need a chance script using promixity prompts and guis. anyone can help me?
1 answer
using math.random() will do, here's the example of the script:
local chance = math.random(1, 2)
if chance == 2 then --// If chance's value is 2 then it will print "2"
print("2")
elseif chance == 1 then --// Else if chance's value is 1 then it will print "1"
print("1")
end
To make this work with proximity prompt, use ProximityPrompt.Triggered
script.Parent.Triggered:Connect(function()
local chance = math.random(1, 2)
if chance == 1 then
print("1")
elseif chance == 2 then
print("2")
end
end)
to play the sound, simply just use Sound:Play(), to make the gui pop up, use GUI.Visible = true
comment if you have questions
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
i dont really know scripting so helping me with this would help alot
use math.random(). example: math.random(1, 3), the "1, 3" means the chance of it happening
ohh ok
thanks but how do i make the guis to pop up? and how will i make music play if the promixity prompt is finished?