I made this script to equip a tool on touch as i have backpack disabled and only want the tool to be equipped when entering a specific area.
function onTouched(hit)
if game.ServerStorage.Main.Values.ToolEquip.Value == 0 then
hit.Parent.Humanoid:EquipTool(game.ServerStorage.Main.Parts.R15)
game.ServerStorage.Main.A1Enemies:Clone().Parent = game.Workspace.Npc
game.ServerStorage.Main.Values.ToolEquip.Value = 1
end
end
connection = script.Parent.Touched:connect(onTouched)
The Value of "ToolEquip" is 0, and this gets no errors.

3 comments
you should clone the tool into the character instead of reparenting it from serverstorage
Remember ServerStorage is only server side, so the client cannot access it. Maybe move it to replicated storage. Because thats both client and server sided.
Thanks for the suggestion ill try it out.