Alright so basically im trying to make a script so that it puts a keycard in the player’s inventory when they click on a police officer that i added to the baseplate. I put a click detector in the police model and a remote even in the workspace. I used a local script for click, and a regular script in the remote event. The part where I need help is in the regular script.
Here is the local script:
Here is the regular script:
Sorry if I just wrote some random codes in the script. Im new to scripting so I dont know much. I thought that if I just add it into the starter pack then I will get the item in my inventory, but it didnt work.
You can put the keycard tool in replicated storage. And do ClickDetector.MouseClick:Connect(function() game.ReplicatedStorage.KeyCard:Clone().Parent = player:WaitForChild(“Backpack”)
replace KeyCard with your tool name
The event that you fired must match on regular script.
-- local script
local ClickDetector = game.Workspace.PoliceOfficer.ClickDetector
-- regular script
local Backpack = player:FindFirstChild("Backpack")
if Backpack then
-- clone your tool to backpack