How do I clone a tool to the player using a GUI? I'm making an admin panel that has options to select tools, but I don't know how to script it correctly. I tried the code in both a LocalScript and Script. Both didn't work, is there something I'm doing incorrectly? Here's my code, for you to correct it:
-- This is a LocalScript inside of a GUI button -- script.Parent.MouseButton1Click:Connect(function(plr) local Taser = game.ServerStorage.Taser:Clone() Taser.Parent = plr.Backpack end)
I also tried doing
local plr = game.Players.LocalPlayer
but to no avail. Please help!
For one, you're identifying an object to the script ending with an action: local Taser = game.ServerStorage.Taser:Clone()
It should be: local Taser = game.ServerStorage.Taser
Try local plr = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function(plr) local Taser = game.ServerStorage.Taser Taser:Clone().Parent = plr.Backpack end)
Wont necessarily solve your problem but here's hoping. :)
just move it into ReplicatedStorage, also players wont see tool when its cloned with local script