I'm making it so that when you press on an item, a gear is in a player's hand. It won't work, though, and there's nothing in the output.
SCRIPT:
Player = game.Players.LocalPlayer TableProp = script.Parent RageTable = game.ReplicatedStorage:WaitForChild("RageTable") function RageTableEquipped() local a = RageTable:Clone() a.Parent = Player.Backpack local b = RageTable:Clone() b.Parent = Player.StarterGear end TableProp.ClickDetector.MouseClick:connect(RageTableEquipped)
The rage table is the gear, and the script is in "CoffeeTableProp"
Thanks
--club101coolguy
This is a very common error made in the early stages of scripting. The reason that your script doesn't work is because LocalScripts do not run if they aren't some sort of descendant of either the player's character, or player instance (such as in GUIs or BackPack). To fix this, make the script a Server Script and change the way Player is accessed. Here is what I did to tackle the problem:
function rageTable() return game.ReplicatedStorage:WaitForChild("RageTable"):Clone() end script.Parent:WaitForChild("ClickDetector").MouseClick:connect(function(player) rageTable().Parent = player.Backpack rageTable().Parent = player.StarterGear end)
Because the argument that is given to the listening event MouseClick for ClickDetectors is the player who clicked the brick, this allows us easy access to the userdata we need. This way, the use of LocalPlayer (which only works in local scripts) isn't necessary.