Things To Know > Local Script > ,Gui Button > ,Everything is in thier proper places > ,No Errors In output > ,Non Filtering Enabled Place
Problem: Let's say I'd join the game, Once i have met all the requirements, I would press the Equip Button, NOTHING HAPPENS, then I leave and join the place again, And I do the EXACT Same thing and press the Equip Button, And it works, IDK why this happens, Second Problem is that if I were to equip and unequip and re-equip the tool would not be there, what i mean by that is that i can equip the tool but i am not holding anything, it's like an empty tool.
Script
player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local Tool = leaderstats:WaitForChild('StoneSword')
local cl = game.ReplicatedStorage:FindFirstChild("StoneSword")
local cl2 = cl:Clone()
local Bought = script.Parent:WaitForChild('HasBought')
local CurImage = script.Parent.Parent:WaitForChild('ImageLabel')
local Equiped = false
local UnequipedColor = BrickColor.new("Really red")
local UnequipedColor2 = UnequipedColor.Color
local EquipColor = BrickColor.new("Lime green")
local EquipColor2 = EquipColor.Color
local AnyEquiped = script.Parent.Parent.Parent.Parent:WaitForChild('MeleeEquip')
local NA = script.Parent:WaitForChild('NA')
local Player = game.Players.LocalPlayer
local Character = player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild('Humanoid')
local Type = script.Parent.Parent.Parent.Parent:WaitForChild('Character'):WaitForChild('Melees'):WaitForChild('ImageLabel')
local sound = script.Parent:WaitForChild('Equip')
--##############YOU CAN IGNORE THE VARIABLES ABOVE####
function Check()
if Bought.Value == true then
if Equiped == false then
if AnyEquiped.Value == false then
Type.Image = script.Parent.Parent.ImageLabel.Image
cl2.Parent = player.Backpack
script.Parent.BackgroundColor3 = EquipColor2
AnyEquiped.Value = true
Equiped = true
script.Parent.Text = 'UnEquip'
sound:Play()
end
end
elseif Bought.Value == true then
if Equiped == true then
Humanoid:UnequipTools()
wait(.1)
Type.Image = NA.Value
player.Backpack:findFirstChild("StoneSword"):remove()
script.Parent.BackgroundColor3 = UnequipedColor2
AnyEquiped.Value = false
Equiped = false
script.Parent.Text = 'Equip'
sound:Play()
end
end
end
script.Parent.MouseButton1Click:connect(Check)
UPDATE: I have added a print, at the very beggining of the script, The local script is NOT disabled and the button is Clickable but NOTHING Prints when i press f9 in play mode, ???????

1 comment
I hae also tried If Bought.Value == True and Equiped == false, sam results