Drop Tool
LocalScript (StarterPlayerScripts)
local userInput = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local dropEvent = ReplicatedStorage:WaitForChild('DropEvent')
local function drop(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.E then
dropEvent:FireServer()
end
end
end
end
userInput.InputBegan:Connect(drop)
Script (ServerScriptService)
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local dropEvent = ReplicatedStorage:WaitForChild('DropEvent')
dropEvent.OnServerEvent:Connect(function(player)
local playerModel = game.Workspace:FindFirstChild(player.Name)
if playerModel then
local tool = playerModel:FindFirstChildWhichIsA('Tool')
if tool then
tool.Parent = game.Workspace
end
end
end)