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
script.Disabled = true
hit.Parent.Humanoid:EquipTool(game.ServerStorage.Main.Parts.R15)
game.ServerStorage.Main.Values.ToolEquip.Value = 1
script.Disabled = false
	end
end

connection = script.Parent.Touched:connect(onTouched)

connection = script.Parent.Touched:connect(onTouched)

I spent a while getting this to work so any help would be appreciated. Thanks :)

4 comments

0

There's a tutorial I followed that helped me out with this same problem. :) Try this - https://www.youtube.com/watch?v=m6Vt9u8uF94

0

That is different to what im doing, my game is an adventure/puzzle game, and when entering an area the tool (sword) will equip allowing the player to fight and when the player kills all the enemies set on him the weapon will Unequip. Thankyou for the help though :)

0

Gotcha. :) Sounds like a pretty cool game concept!

0

Thankyou i hope it pans out well i just really need someone to help me with this so i can carry on making it :/