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

The EXP Bar is not working correctly?

Asked by 8 years ago

I need help on making an exp bar like the one similar to ROBLOX Deathrun. Is it possible to be assisted?

Here's the script:

-- This is in a local script

local bar = script.Parent
local xpbar = bar.EXPBar
local overlay = xpbar.Overlay
local player = game.Players.LocalPlayer

if player:FindFirstChild('leaderstats') then
    overlay:TweenSize(UDim2.new(player.EXP.Value/player.EXP.Value, 0, 1, 1, 0))
end
0
There are 5 values for Udim2? chill22518 145 — 8y
0
My fault. FearlessAfrican 34 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago
local player=game.Players.LocalPlayer
local bar=script.Parent
local xpbar=bar.EXPBar
local overlay=pbar.Overlay

player.EXP:Changed:connect(function(property) --This will check if the amount of EXP they have changed
    if property=="Value" then --This is checking if the property is value, value being the amount they have
        local exp=player.EXP[property] --This will get the amount of EXP they have
        local expMath=exp/(ExpValueNeededGoesHere) --If they have all the EXP needed (100/100 for example), expMath will equal 1, and take up the entire bar. If they're 50/100, it will equal .5 and take up half
        overlay:TweenSize(UDim2.new(expMath,0,1,0) --Tween from its current position to the new one
    end
end)

This SHOULD work. I can't really help as much, as I do not know where everything is.

0
You should try to explain to them how you came to your solution. Simply doing it for them without explaining your thought process is a bad way of advancing knowledge. User#11440 120 — 8y
0
Does it work, though? SimplyRekt 413 — 8y
0
Nope FearlessAfrican 34 — 8y
Ad

Answer this question