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

MaxMana is not a valid member of ScreenGui?

Asked by 4 years ago
Edited 4 years ago

The error is at the if statement Can someone please tell me how to fix this? its not finding the int value even though it exist in the gui!

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then
        if script.Parent.Equip.Value == true and SlashCool == false and ManaGui.MaxMana.Value > 0 then
            if ManaGui.MaxMana.Value > 20 then
                SlashCool = true
                ReFol.RSKILL:FireServer()
                ManaGui.MaxMana.Value = ManaGui.MaxMana.Value - 20
                wait(5)
                SlashCool = false
            else
                    ManaGui.ManaEn.Visible = true
                    ManaGui.ManaFrame.Frame.TextLabel.Text = "Not Enough Mana"
                    wait(.3)
                    ManaGui.ManaEn.Visible = false
                    ManaGui.ManaFrame.Frame.TextLabel.Text = "Mana"
            end
        end
    end
end)

EDIT:when you die and respawn it will says that it cant find maxMana

0
try :WaitForChild() and see if you get infinite yield DejaSketch 84 — 4y
0
im getting infinite yield Cyrellejheff 11 — 4y
0
Is maxmana in startergui? DejaSketch 84 — 4y
0
its in a Gui that's in starter gui Cyrellejheff 11 — 4y
0
put a print statement at the very top of your code to check if the script is running Code1400 75 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

Use wait for child, which yields until the child is loaded or existed.

0
That was my first option,didn't work. Cyrellejheff 11 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I Somehow fix it i don't know how though And i didn't use wait for child

Answer this question