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

Energy drain script problems?

Asked by
chrono2 189
10 years ago

So I have this localscript in a weapon. It's intended to drain the bar value of the energy GUI when you fire the weapon, but it doesn't seem to be working properly. Anyone have any clue why?

BV = Player.StarterGui.BorgGui.BarValue

function onActivated()
    BV.Value = BV.Value - 5
end

1
Did you connect or trigger the function? Tesouro 407 — 10y
1
To be honest, I've never worked with Localscripts before, so probably not. That's the entire code right there. chrono2 189 — 10y
0
LocalScripts only differ from normal Scripts in that they run on the Client instead of the Server. You connect events and functions exactly the same way on both. adark 5487 — 10y

1 answer

Log in to vote
0
Answered by
lomo0987 250 Moderation Voter
10 years ago
BV = Player.StarterGui.BorgGui.BarValue

function onActivated()
while true do
wait(1)
if BV.Value > 5 then
    BV.Value = BV.Value - 5
elseif BV.Value =< 5 then
    BV.Value = 0
end
end
end

This should drain the energy to 0.

Ad

Answer this question