Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 7 years ago
Edited 7 years ago

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?

0
Use values. I'll right a code block later. I'm on my phone right now. Magnetic_Aviator 21 — 7y
1
What do you mean by use values? damnit_dolan 15 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

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 ;)

0
OK thanks for the help mate! damnit_dolan 15 — 7y
0
No problem, glad to help. BlackOrange3343 2676 — 7y
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? damnit_dolan 15 — 7y
Ad
Log in to vote
-2
Answered by 7 years ago

Values.

Answer this question