I'm trying to make it to where once I enable a tool It gives me a sword This script is the closest I have came to it but I need a click detector and it doesn't give me a sword when I enable it.
function hi(x) y = x.Backpack z = game.Lighting["LinkedSword"] z:Clone().Parent = y end script.Parent.ClickDetector.MouseClick:connect(hi)
The problem with this is that I need a click detector, and when I enable the tool it doesnt give me a sword, I have to click the tool when its laying down on the ground instead. Any idea on how I could enable a tool and it will give me a sword?
I do believe that ClickDetectors do not fire if you have anything selected. If you want to detect when a player clicks on something, regardless of what they have selected, you can use game.Players.LocalPlayer:GetMouse()
to access the mouse outside of a tool, then fire a signal to a RemoteEvent to signal the server to give the player a tool, or more simply (if the game is not FilteringEnabled) just grant the tool to the player from the same script in the client.