Problems with values and proximity prompt

  1. What do you want to achieve? Keep it simple and clear!
    I want to do that when the proximity prompt is triggered remove everything from a value and update the leaderstats

  2. What is the issue? Include screenshots / videos if possible!
    The script doesn’t seem to work at all

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried shearching or changing the script but yet no solution

Here is the script

script.Parent.Triggered:Connect(function(plr)
	local Cash = plr.leaderstats.Money.Value

	local V1 = plr.PlayerGui.ScreenGui.Inv.AStone.BTexts.BNumber.Value.Value

	Cash = Cash + (V1*10)
	V1 = 0
end)

Script is in proximity prompt and is not a LocalScript

1 Like

It may require being a local script. And in order to get the data on the server you would need to create a remote event and send the data to be processed on the server. Idk honestly I’d have to test out a proximity prompt to be certain. You could pop a print statement into the function and see if it prints. This would at least tell you the function is being run.

Any error logs?

And another question, the name of the value is Value? i.e., at the end you put Value.Value.

local V1 = plr.PlayerGui.ScreenGui.Inv.AStone.BTexts.BNumber.Value.Value

The script is being run, it does print, but yet no changes have been done with the Values

Edit, I have tried using a local script too

No errors, the values is named Value

Try with this code:

script.Parent.Triggered:Connect(function(plr)
	local Cash = plr.leaderstats.Money
	local V1 = plr.PlayerGui.ScreenGui.Inv.AStone.BTexts.BNumber.Value

	Cash.Value = Cash.Value + (V1.Value * 10)
	V1.Value = 0
end)

1 Like

It works perfectly, thanks man!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.