Swap Tools
Tool Script
local tool = script.Parent
local function updateTool(otherPart)
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player then
player.CurrentTool.Value = tool.Name
end
end
tool.Handle.Touched:Connect(updateTool)
ServerScriptService
local function onPlayerJoin(player)
local CurrentTool = Instance.new('StringValue')
CurrentTool.Name = 'CurrentTool'
CurrentTool.Parent = player
local toolCheck = game.ServerStorage.ToolUpdate:Clone()
toolCheck.Parent = game.Workspace:WaitForChild(player.Name)
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
ServerStorage (Name ToolUpdate)
local player = game.Players:FindFirstChild(script.Parent.Name)
local Current = player.CurrentTool
Current.Changed:Connect(function()
wait(.01)
local otherTool = player.Backpack:FindFirstChildWhichIsA('Tool')
if otherTool then
otherTool.Parent = game.Workspace
otherTool.Handle.Position = otherTool.Handle.Position + Vector3.new(10,-4,0)
end
end)