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

DO I HATE BLACKS? [closed]

Asked by 6 years ago
Edited 4 years ago

blacks are dumb lol this was edited

0
This is not a script writing service, we will help you solve bugs, we will not script for you. AlphaGamer150 101 — 6y

Closed as Not Constructive by minikitkat

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 5 years ago

Here's a simple example,

Let's say the player wants to level up to level 2, First, he will need to get a certain amount of XP and now, how would we implement that? Easy! first we are going to make the XP value and the Level value

local XP = Instance.new("IntValue")
local Level = Instance.new("IntValue")

We created the Values! But what now you ask? We are going to compare numbers, so when the player reaches a certain amount of XP he levels up! and we do that by using an IF statement

local NeededXP = 500
if XP.Value == NeededXP then
 Level.Value = Level.Value + 1
end

Now we completed the mission, but wait! What if we want to increase the amount of XP needed to level up. Simply we double(or increase however you want) the value of NeededXP and we do that by using this way

NeededXP = NeededXP * 2 --(we double the number)

And thats it!

Completed script:

--Creating values.
local XP = Instance.new("IntValue")
local Level = Instance.new("IntValue")
--Creating a value to compare the XP with
local NeededXP = 500
-- We compare the XP with the NeededXP and check if they are the same!
if XP.Value == NeededXP then
 Level.Value = Level.Value + 1 --Increase the level by 1
 NeededXP = NeededXP * 2 --Double the NeededXP to level up!
end

Good luck scripting!

0
If this works, please accept the asnswer, it really helps out! mixgingengerina10 223 — 6y
Ad