Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you create a script that gives you in game points on click?

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?

2 comments

0

Use values. I'll right a code block later. I'm on my phone right now.

1

What do you mean by use values?

2 answers

✓ Accepted answer

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;

  1. 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

0

OK thanks for the help mate!

0

No problem, glad to help.

0

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?

This discussion is preserved as it was. New answers, comments, and votes are closed.