How do I make the "Holster" appear immediately when entering the game

I want the sword to appear on the player’s body immediately after entering the game, so that the player does not need to equip it so that it appears later.


image

I recently found a ready-made script so that after the tool was removed from the player’s hand it would remain on his body

local Tool = script.Parent
local Handle = script.Parent:WaitForChild("Handle")
function Equipped(Mouse)
	Player = script.Parent.Parent
	if Player:FindFirstChild("Holster") then
		Player.Holster:remove()
		script.Equp:Play()
	end
end

function Unequipped(Mouse)
	if Player:FindFirstChild("Holster")==nil then
	local Holster = Handle:Clone()
local BackAttachment = Instance.new("Attachment")
BackAttachment.Axis = Vector3.new(0, 1, 0) --change to (0,-1,-1) if you want it on the torso's front
BackAttachment.Name = "WaistAttachment"
BackAttachment.Parent = Holster
Holster.Parent = Player
Holster.Name = "Holster"
local Torso = Player:FindFirstChild("UpperTorso") or Player:FindFirstChild("Torso")
	if Torso then
	local w=Instance.new("Motor")
		w.Part0=Holster
		w.Part1=Torso
		w.C0=BackAttachment.CFrame+Vector3.new(-1,1,-0.3)
		w.Parent=Holster
	end
end
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)

if Player.Character.Humanoid.Health == 0 then
	Player.Holster:remove()
end

But now I want the sword to appear on the player’s body before he equipped it for the first time. I made a similar script and put it in workspace:

game.Players.PlayerAdded:Connect(function(player)
	if player:FindFirstChild("Holster")==nil then
		local Holster = game.StarterPack.Sword.Handle:Clone()
		local BackAttachment = Instance.new("Attachment")
		BackAttachment.Axis = Vector3.new(0, 1, 0) --change to (0,-1,-1) if you want it on the torso's front
		BackAttachment.Name = "WaistAttachment"
		BackAttachment.Parent = Holster
		Holster.Parent = player
		Holster.Name = "Holster"
		local Torso = player:FindFirstChild("UpperTorso") or player:FindFirstChild("Torso")
		if Torso then
			local w=Instance.new("Motor")
			w.Part0=Holster
			w.Part1=Torso
			w.C0=BackAttachment.CFrame+Vector3.new(-1,1,-0.3)
			w.Parent=Holster
		end
	end
end)

The script works but incorrectly, the Holster is placed in another place and does not affect the player.


image
here is the player’s folder after equipping and unequpping the sword
image

how do I get the path to the player’s folder?

Thanks

game.Players.PlayerAdded:Connect(function(player)
	if player:FindFirstChild("Holster")==nil then
		local Holster = game.StarterPack.Sword.Handle:Clone()
		local BackAttachment = Instance.new("Attachment")
		BackAttachment.Axis = Vector3.new(0, 1, 0) --change to (0,-1,-1) if you want it on the torso's front
		BackAttachment.Name = "WaistAttachment"
		BackAttachment.Parent = Holster
		Holster.Parent = player.Character
		Holster.Name = "Holster"
		local Torso = player:FindFirstChild("UpperTorso") or player:FindFirstChild("Torso")
		if Torso then
			local w=Instance.new("Motor")
			w.Part0=Holster
			w.Part1=Torso
			w.C0=BackAttachment.CFrame+Vector3.new(-1,1,-0.3)
			w.Parent=Holster
		end
	end
end)

Your original line was

player is the instance inside the Players part of explorer. You need to get their character, so

Holster.Parent = player.Character

Thank you for your quick response, but I think I did not get the player correctly, holster used to appear on the game path.Players.“Player” now it doesn’t appear anywhere, it should get into workspace.“Player”


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if char:FindFirstChild("Holster") == nil then
			local Holster = game.StarterPack.Sword.Handle:Clone()
			local BackAttachment = Instance.new("Attachment")
			BackAttachment.Axis = Vector3.new(0, 1, 0) --change to (0,-1,-1) if you want it on the torso's front
			BackAttachment.Name = "WaistAttachment"
			BackAttachment.Parent = Holster
			Holster.Parent = char
			Holster.Name = "Holster"
			local Torso = player:FindFirstChild("UpperTorso") or player:FindFirstChild("Torso")
			if Torso then
				local w=Instance.new("Motor")
				w.Part0=Holster
				w.Part1=Torso
				w.C0=BackAttachment.CFrame+Vector3.new(-1,1,-0.3)
				w.Parent=Holster
			end
		end
	end)
end)

Try this

This thing appeared but for some reason away from the player

I haven’t started making such a feature yet, but if someone solves this issue, I would appreciate it.