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

Label is not showing up [FE]!?

Asked by 5 years ago
Edited by antonio6643 5 years ago

Well, the label is not showing when the button is pressed! Script:

-- VARIABLES
local Player = game:GetService("Players").LocalPlayer
local Storage = game:GetService("ReplicatedStorage"):FindFirstChild("Storage")
local Swords = Storage:WaitForChild("Swords")
local Database = Player:WaitForChild("Database")
local ValueFolder = Database:FindFirstChild("Value_Inv")
local MeltingLabel = script.Parent.Parent.Parent.Parent:FindFirstChild("MeltingInfo")
local meltingeffect = script.Parent.Parent.Parent.Parent:FindFirstChild("Melting")
-- CODE

script.Parent.MouseButton1Click:Connect(function()
    local debounce = false
    if ValueFolder.IronOre_Value.Value >= 1 then
        if not debounce then
            debounce = true

        ValueFolder.IronOre_Value.Value = ValueFolder.IronOre_Value.Value - 1
        wait()
        MeltingLabel.Visible = true
        meltingeffect:Play()
        wait(3)
        meltingeffect:Stop()
        MeltingLabel.Visible = false
        ValueFolder.IronIngot_Value.Value = ValueFolder.IronIngot_Value.Value + 1
        end

    else
        -- Code here

    end
    wait(1)
    debounce = false
end)

Well, the output is *attempt to index upvalue 'MeltingLabel" (a nil value)! Line 19' *

Explorer ->> https://imgur.com/a/CsCIp0N

1 answer

Log in to vote
1
Answered by 5 years ago

I'm assuming this is in a LocalScript. Your code looks fine, try changing the FindFirstChilds to WaitForChilds on lines 3, 6, 7, and 8. Usually, the script runs before such objects are loaded into the game, and thus using FindFirstChild may often return a nil value.

Hope this helps

0
Thanks mate, I really appriciate your answer cuz I totaly forgot about WaitForChild option... Thank you! AswormeDorijan111 531 — 5y
Ad

Answer this question