I want it so when I click the ClickDetector it'll clone a Tool from ServerStorage and put it in the player's backpack, I've come up with this but I don't know what's wrong with it.
local Tool = game.ServerStorage.ToolEx local Player = game.Players.LocalPlayer local ClickDet = script.Parent ClickDet.MouseClick:Connect(function() local ClonedTool = Tool:Clone() ColendTool.Parent = Player.Backpack end)
Any help would be much aprichiated!
You are trying to use LocalPlayer in a Server Script what you'll have to use instead is the Player passed in MouseClick(the Player who clicked) like this
local Tool = game.ServerStorage.ToolEx local ClickDet = script.Parent ClickDet.MouseClick:Connect(function(Player) local ClonedTool = Tool:Clone() ClonedTool.Parent = Player.Backpack end)
You can learn more about ClickDetectors here and about why LocalPlayer doesn't work in this case here
[Answered]
Simply not in a LocalScript.
Locked by PrismaticFruits and DeceptiveCaster
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?