Tool falling on the ground when given through script

I want to make it so the player gets a sword

the sword falls on the ground since its not on starterpack

i tried looking it up i havent found anything

the tool falls on the ground and that annoys me could anybody find a solution for me

	game.ReplicatedStorage.Sword:Clone().Parent = plr.Character

Use plr.Character.Humanoid:EquipTool() on the server instead.

how do i use that doe do i like put the location of the sword inside of the ()

You can look up how to use it here.

i dont think that worked Im trying to clone the tool and give it to the player

plr.Character.Humanoid:EquipTool(game.ReplicatedStorage.Sword:Clone())

it still falls on the ground doe

Are you using it on a localscript? (edited)

are you asking if its a local script

yes its a local script… is that a problem

Yes, tools should exist on the server so welds can be created to keep it in your hand.

i tried converting it into a server script it didnt work

Does it still fall on the ground or what?

it falls on the ground but i think i need to make it a server script but the problem is that idk how to do that cuz i tried doing that by changing the localplayer to the player added event and didnt work

Could you show your new script?

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local sword = ReplicatedStorage:WaitForChild("Sword")

Players.PlayerAdded:Connect(function(player)
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:WaitForChild("Humanoid")
	local swordClone = sword:Clone()
	humanoid:EquipTool(swordClone)
end)

Don’t know, haven’t worked with tools.
This is the entire script you need. Put this in ServerScriptService and you should be good, I think.

local plr = game.Players.PlayerAdded:Connect(function()
	local Teams = game:GetService("Teams")
	wait(1)
	if plr.Team == Teams.Spys then
		plr.Character.Humanoid:EquipTool(game.ReplicatedStorage.Sword:Clone())
	end
end)
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Teams = game:GetService("Teams")

local sword = ReplicatedStorage:WaitForChild("Sword")

Players.PlayerAdded:Connect(function(player)
	local character = player.Character or player.CharacterAdded:Wait()
	if player.Team == Teams.Spys then
		local humanoid = character:WaitForChild("Humanoid")
		local swordClone = sword:Clone()
		humanoid:EquipTool(swordClone)
	end
end)

That should do the trick…

where do i put the script doe…

That’s everything you need in one single script in ServerScriptService.

Also, don’t use wait(). Apart from it being deprecated soon, you can simply yield the function until the character loads in using CharacterAdded:Wait().

If you want to yield, use task.wait(). It’s more accurate and it servers to yield the thread, not the entire script.