I want to make my own giver, I think I've done the basics (I tested it out a slight bit different way to spawn a car, worked), but I'm struggling to get the tool to the player's Backpack
who cloned it.The script is a LocalScript
Here's what I've done:
local Button = script.Parent local Flashlight = game.ServerStorage.NATMFlashlight local Inventory = game.Players.LocalPlayer function OnClicked() CopyBoy = Flashlight:Clone() CopyBoy.Parent = Inventory.Backpack end Button.ClickDetector:connect(OnClicked)
"ClickDetector" is not an event. The event that fires when it is clicked is "MouseClick", and must be handled by a server script.
Put this code in a Script (not a LocalScript) inside the "Button"
local Button = script.Parent local Flashlight = game.ServerStorage.NATMFlashlight function OnClicked(Inventory) -- The player that clicked is a parameter to the function. CopyBoy = Flashlight:Clone() CopyBoy.Parent = Inventory.Backpack end Button.ClickDetector.MouseClick:Connect(OnClicked)