Hey Devs! I’m making a prompt when is triggered it gives you +5 gold. If this is obvious to make, sorry, I’m a beginner scripter. Everything is in local scripts.
-
What do you want to achieve? When proximityprompt.Triggered I need to add 5 gold to the player. (leaderboard value)
-
What is the issue? I tried using many ways and scripts and I didn’t think I would have problems with a simple thing like that. It doesn’t work
-
What solutions have you tried so far? Searched the internet and tried making many scripts.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- I put it in ProximityPrompt for now. I used StarterPlayerScripts and Server Script Service too.
-- this is my last script I have for it so it may be bad.
local playerModel = script.Parent
local player = game.Players:GetPlayerFromCharacter(playerModel)
game.ReplicatedStorage:WaitForChild("leaderstats")
player.leaderstats:WaitForChild("IntValue")
workspace.WorkButton.ProximityPrompt.Triggered:Connect(function(player)
local gold = player.leaderstats.IntValue
if player then
gold.Value = gold.Value + 5
end
end)
Thanks for all the answers!