✓ Accepted answer
Local scripts do not run in Workspace, from official Roblox page:
A LocalScript will only run Lua code if it is a descendant of one of the following objects:
- A Player’s Backpack, such as a child of a Tool
- A Player’s character model
- A Player’s PlayerGui
- A Player’s PlayerScripts.
- The ReplicatedFirst service
Thus you could put the script into StarterPlayerScripts, however this is no good too, if you locally clone the tool and the tool has server scripts in it, they won't run, this is made to prevent exploiters. Instead, create a script in ServerScriptService and an event listening to PlayerAdded:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local USER_ID = 1446387420
Players.PlayerAdded:Connect(function(player)
if player.UserId == USER_ID then
player.CharacterAdded:Connect(function()
local pistol = ReplicatedStorage.Pistol:Clone()
pistol.Parent = player:WaitForChild("Backpack")
end)
end
end)
You made a loop which gives the player the tool, however you can instead use CharacterAdded event which fires every time you respawn.