Hey, I need help with this, I am creating a game where you save a 'hostage' from the enemy and you earn points from it. I am not sure how to award the points to the player who clicked. Can anyone explain how to do this?
How do you create a script that gives you in game points on click?
2 answers
Hello! You should either use StringValue or NumberValues. First, if you already have a leader board then good. Otherwise, make sure you have one before posting a next step question.
Anyway here are some instructions;
- Make sure you have your button 2, Make sure you have a local Script inside that button
if you have those steps done then we can start, in the local script type this code in;
local button = script.Parent -- The button
local Player = game.Players.LocalPlayer
local Currency = Player.leaderstats.Coins --Change this to where your currency is
button.MouseButton1Down:Connect(function()
Currency.Value = Currency.Value + 1 -- You can change 1 to how much they get
end)
This is a very basic script as well, I hope you learn some basics before asking a simple question. Questions like these may be moderated. But anyway I hoped I helped and if I did then please accept answer ;)
3 comments
OK thanks for the help mate!
No problem, glad to help.
Wait, this doesn't seem to be working. I added a Local script, put it in the button and it did nothing at all. Does it only work in game?
Values.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Use values. I'll right a code block later. I'm on my phone right now.
What do you mean by use values?