I have a problem .My script doesn’t work for some reasons. No error were found and I also tried to debug but I can’t see the problems any help is appreciated
here is my script;
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:FindFirstChild("Humanoid")
for i , v in pairs(script.Parent:GetChildren())do
if v:IsA("ImageButton") then
v.Activated:Connect(function()
print("bruh")
if v.CanDes.Value == false then
v.CanDes.Value = true
v.BackgroundColor3 = Color3.fromRGB(75,75,75)
local item = game.ReplicatedStorage:FindFirstChild(v.Name)
if item and item.Parent ~= player.Backpack or item.Parent ~= char then
local clone = item:Clone()
clone.Parent = player.Backpack
hum:EquipTool(clone)
end
end
end)
end
end
game.ReplicatedStorage.EquipTool.OnServerEvent:Connect(function(player , item)
local tol = game.ReplicatedStorage:FindFirstChild(item)
local char = player.Character or player.CharacterAdded:Wait()
if tol and tol: IsA("Tool") then
if tol.Parent ~= char or tol.Parent ~= player.Backpack then
local clone = tol:Clone()
tol.Parent = player.Backpack
print(tol.Name)
end
end
end)