I am in the process of making a simulator game, and I need help. I want to make it so that if you walk up to a rock, a proximity prompt will show up. After you trigger the proximity prompt, you should then get +1 money. I have had some trouble with this and don’t know how to solve it. Youtube doesn’t really have what I’m looking for either.
Where will the money be stored? Is it through datastores or server only?
Whats the difference? Sorry im just rly new to scripting
Search ‘Proximity Prompt’ on developer.roblox.com and it will tell you how to connect the events.
Also if you are new, DataStoring may be a bit much at your stage, experiement with easier things before going on the more complicated stuff.
I assume this is via a leaderstat. Insert this SERVER SCRIPT inside the proximity prompt
local Prompt = script.Parent
Prompt.Triggered:Connect(function(Player)
local Money = Player.leaderstats.Money
Money.Value += 1
end)
At their stage, I think Money.Value = Money.Value + 1 would make more be more understandable for them. But your example would probably solve the issue.
1 Like
You probably should have marked this as the solution.
local Prompt = script.Parent
Prompt.Triggered:Connect(function(Player)
local Stat = Player.leaderstats:FindFirstChild("IntValue")
if Stat then
Stat.Value += 1
end
end)
1 Like