I'm trying to make a game with an equipment GUI, and I encountered an error.
My script is below.
script.Parent.MouseButton1Click:Connect(function() if game.Players.LocalPlayer.leaderstats.Tier.Value >= 5 then game.Players.LocalPlayer.EquippedTool.Value = tostring(script.Parent.Name) script.Parent.BorderSizePixel = 5 script.Parent.ZIndex = 2 for i, image in pairs(script.Parent.Parent:GetChildren()) do if image.Name ~= script.Parent.Name then image.ZIndex = 1 image.BorderColor3 = Color3.new(0,0,0) image.BorderSizePixel = 1 end end script.Parent.BorderColor3 = Color3.new(255,0,0) script.Parent.Parent.Parent.TextButton.Text = "Currently Equipped: "..script.Parent.Name else script.Parent.Parent.Parent.TextButton.Text = "You need to be at least Tier 5 for this!" end end)
It comes out with an error that says "Tier is not a valid member of IntValue"
I have no idea how to fix this.
Thank you!
--[[ This i can help you with. Try this example. if plr.leaderstats:WaitForChild("Tier").Value == 100 then (function here) end if this doesn't work. It either means Tier doesn't exist in the hierarchy. Add a function to wait for the object. If my example worked. Then it's been fixed. You're welcome. ]]