function oc() local sword = game.ReplicatedStorage.Sword:Clone() sword.Parent = game.Players.LocalPlayer.Backpack end script.Parent.ClickDetector.MouseClick:connect(oc)
When you click this button, it's supposed to give you a sword. It doesn't work, and it doesn't even bother to give me an error in the output.
You probably already fixed this, but just answering so you can mark it as an accepted answer so that people wont look through this question thinking its unanswered.
The ClickDetector.MouseClick() function passes through the object which clicked it (only players because bricks dont have mouse cursors), which you can then use to give the tool to the player.
Example:
function oc(player)
The (player)
argument is the object which clicked on it. This can be renamed to anything, as it is just a variable.
Heres an example --v
function oc(player) local sword = game.ReplicatedStorage.Sword:Clone() sword.Parent = game.Players[player.Name].Backpack end script.Parent.ClickDetector.MouseClick:connect(oc)