I’m making a Hood game right now, and so I need something for Criminals to rob:
I have this ATM right here, that How2Roblox put out there:
Here’s the Script:
game.Players.PlayerAdded:Connect(function(plr)
local ls = Instance.new("Folder")
ls.Name = "leaderstats"
ls.Parent = plr
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Parent = ls
end)
local pps = game:GetService(“ProximityPromptService”)
pps.PromptTriggered:Connect(function(pp, plr)
if pp.Name == "RobPrompt" then
local robbedAmount = math.random(100, 500)
plr.leaderstats.Cash.Value += robbedAmount
pp.Enabled = false
wait(30)
pp.Enabled = true
end
end)
Inside of the ATM is a Group with the parts that the ATM has, and a part that contains the Click Detector, any Idea on how I could add sound to it once someone is done robbing it?
Simply create a sound instance and parent it to the atm, I would parent it to the part they are able to rob from. And then you could use 'sound:Play()` in your script, put it during their robbery/after they finished.
No “sound” is just an example you have to create the Instance “Sound” and reference it so you can put it in your script. For example: if my sound name was “RobbingSound” i would do script.RobbingSound:Play()