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

I followed instructions by another person on this website, but it did not work, I dont know why?

Asked by 5 years ago

this is the code located in a script in starter gui (also in starter gui is a ScreenGui, 'Staminabar', in which inside that is a frame 'Frame'

local Player = Tool.Parent.Parent -- tool is inside backpack which is inside player

local Stamina =  game.StarterGui.Staminabar.Frame
local RemoteEvent = game.StarterGui.Staminabar.Frame.RemoteEvent
-- not sure where you have these things so I left them as empty variables, for the sake of the example

local Equipped = false

Tool.Equipped:Connect(function()
    Equipped = true
    -- important things pertaining to what your tool does here
    while true do
        Stamina.Value = Stamina.Value - 1 -- 1 is how much stamina is being subtracted each loop
        if Stamina.Value ~= 0 then
            RemoteEvent:FireClient(Player, Stamina.Value) -- do your gui work
            if Equipped = false then
                break
            end
        else
            Player.Character.Humanoid:UnequipTools()
            break
        end
        wait(1)
    end
end)

Tool.Unequipped:Connect(function()
    Equipped = false
end)
0
remote events is in frame btw RamenRobloxian 2 — 5y
0
I am trying to do a stamina bar for tools RamenRobloxian 2 — 5y
0
You need two equal signs on line 16 "==" royaltoe 5144 — 5y

Answer this question