Currently I am trying to use a proximity prompt to let the player interact and change the ‘Money’ leaderstat, but I have tried multiple different ways like using a local script to check if the player has triggered the proximity prompt, I’ve used normal scripts that trigger a local script to cause the trigger, but nothing seems to work, can you help.
Your remotes can be spoofed by exploiters. Also, OnClientEvent doesn’t pass the player because you’re already on the client so you can get the player separately. Only have the GiveAmount parameter.
You don’t need to fire a remote to the client to fire a remote back to the server. If you need to fire from a server script to another server script you can use BindableEvent | Roblox Creator Documentation which would look something like this :
Unless u have a way to check if the player is actually not exploiting or has the perms to do that in the serverscript that gives the coins then it’s fine.
As people in the replies have pointed how the way you do this is very unsecure especially when .Triggered is fired on the server as well.
So what you’ll probably want to do is remove those last 2 parts and update their money inside of the ProximityPrompt.Triggered event.
Ex
ProximityPrompt.Triggered:Connect(function(player)
player.leaderstats.Money.Value += 10
print("Money added to player: "..player.Name)
end)
-- Make sure this is a server script
The number 1 rule when dealing with remote events/functions is to never trust the client
Never give the client a remote event that with its passed arguments can edit things like their money on the server
As @0xzemqkaixlqpolwmzvn said if you want to communicate from script to script use a BindableEvent