Anyway I made a tool that has a secret feature, when pressing E It gives you a tool that lets you put people In jail, however It appears that I am attempting to Index nil with 'Backpack'???
Script (Local script):
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.E then
script.Parent.GiveItem:FireServer()
end
end)
Script (Server script):
local tool = script.Parent
local ReplicatedStorage = game.ReplicatedStorage
local HiddenTools = ReplicatedStorage.SecretItems
local Player
game.Players.PlayerAdded:Connect(function(client)
Player = client
end)
tool.GiveItem.OnServerEvent:Connect(function()
local JailCell = HiddenTools["Jail Cell"]:Clone()
JailCell.Parent = Player.Backpack
tool.UserInputService:Destroy()
script:Destroy()
end)
