Save value on proximity prompt triggered

Hello developers,

I’m trying to make it so whenever a player triggers a proximity prompt adds 5 to a value. How could i also make it so it saves whenever someone triggers it?

Thanks alot!

What do you mean by:

Like the prompt disappear or can’t be pressed again or like a server message pop’s up?
Can you be more specific about this part.

So whenever someone triggers the proximity prompt it adds 5 to a value AND saves the new value

Hmm about the saving part, you don’t really need to save every prompt with datastore.

And for the the prompt to add 5 to the value you would need to use a server script if it’s visible to every player, if its only for certain players then you have to use remote event. Here’s more information about proximity prompt.

https://create.roblox.com/docs/building-and-visuals/ui/proximity-prompts

To save the value you would need to use datastore to set the data and to get the data when ever a player leave’s/join. Here’s more information about datastore.

https://create.roblox.com/docs/scripting/data/data-stores