Ok so I have a localscript in a textbutton that checks if a boolvalue thats in the player is true or not, and then if its true it clones a specified tool into the players backpack but it doesn't clone. Heres the script:
script.Parent.MouseButton1Down:Connect(function() local player = game.Players.LocalPlayer local Sharingan = game.ReplicatedStorage.KG:FindFirstChild("Itachi Mangekyou"):Clone() local SharValue = player.KGvalues:FindFirstChild("Sharingan") SharValue.Changed:Connect(function() if SharValue.Value == true then Sharingan.Parent = player.Backpack end end) end)
Here are a few suggestions first:
I would recommend using the Activated event instead of MouseButton1Down. Also, we really only use the FindFirstChild() function to check whether the object exists. If you're sure the object exists, there's really no point in using it.
Here's what I think the problem that's breaking your script is:
You're firing this from a local script, but you're using it to directly clone something into the player. Because of FilteringEnabled, this will not work.
I would suggest firing a RemoteEvent or RemoteFunction using FireServer() or InvokeServer(). So, I would put a remote event into Replicated Storage and replace line 8 with something along the lines of this:
game.ReplicatedStorage.RemoteEvent:FireServer(player)
Then, I'd create an event in a server script like this:
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(plr) local Sharingan = game.ReplicatedStorage.KG:FindFirstChild("Itachi Mangekyou"):Clone() Sharingan.Parent = plr.Backpack end)