Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Label is not showing up [FE]!?

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

✓ Accepted answer

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

1 comment

0

Thanks mate, I really appriciate your answer cuz I totaly forgot about WaitForChild option... Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.