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

DO I HATE BLACKS?

blacks are dumb lol this was edited

1 comment

0

This is not a script writing service, we will help you solve bugs, we will not script for you.

1 answer

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!

1 comment

0

If this works, please accept the asnswer, it really helps out!

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