I reposted this as it was getting no attention for 28 minutes. Here is my problem: I am trying to create a weapon switching system, but its broken. Sorry for the lack of details
script.Parent.OnServerEvent:Connect(function(player, effect)
if effect=="NextItem" then
print("effenet")
player.Character:FindFirstChildOfClass("Humanoid"):UnequipTools()
local numberon=0
local Children = player.Backpack:GetChildren()
print(numberon==player.Character.ToolOn.Value)
if numberon==player.Character.ToolOn.Value then -- false
numberon+=1
if Children[numberon]:IsA("Tool") then
print("Tool = " .. player.Character.ToolOn.Value)
print("NumberOn = " .. numberon)
player.Character:FindFirstChildOfClass("Humanoid"):EquipTool(Children[player.Character.ToolOn.Value])
player.Character.ToolOn.Value=player.Character.ToolOn.Value+1
if player.Character.ToolOn.Value==(#Children) then
player.Character.ToolOn.Value=0
numberon=0
print("reset sucessful")
end
end
end
end
end)