Problem with a game tool

Hi, I have the following code

function module.TeleportFirst(players, mapSpawns)

	for i, v in pairs (players) do
		if v.Character then
			local character = v.Character
			local knife = game.ServerStorage.Tools.Knife:Clone()
			knife.Parent = character
			if character:FindFirstChild("HumanoidRootPart") then
				
				v.Character.Humanoid.WalkSpeed = 16

				local rand = Random.new()
				v.Character.HumanoidRootPart.CFrame = mapSpawns[rand:NextInteger(1,#mapSpawns)].CFrame Vector3.new(0,15,0)

			end
		end
	end
end


function module.TeleportRemaining(players, mapSpawns) 

	for i, player in pairs (players) do
		if player.Character then
			local character = player.Character
			local Crossbow = game.ServerStorage.Tools.Crossbow3:Clone()
			Crossbow.Parent = character
			if character:FindFirstChild("HumanoidRootPart") then
				
				player.Character.Humanoid.WalkSpeed = 16
				

				local rand = Random.new()
				player.Character.HumanoidRootPart.CFrame = mapSpawns[rand:NextInteger(1,#mapSpawns)].CFrame + Vector3.new(0,10,0)

			end
		end
	end
end

So, for the first function, this works okay as the players that i want to receive the ‘Knife’ to do so without issue. However, for the second function, the players that are to receive the ‘ingame’ only do so for a split second after they teleport into the map- To which then it quickly dissapears probably in about (0.1s)
Has anyone heard of this issue before?

One thing I believe would perhaps fix this is having the Crossbow going into the backpack/toolbar at the bottom as opposed to giving the player it directly into their hands when they spawn- How would i go about doing this for the crossbow?

Thanks in advance

You could simply add the crossbow to their character!

Does the Crossbow.Parent = Character part not already do this? thanks

Oh, sorry, I misread your post! Yes, it does already do that…

Managed to solve this problem so il delete the post! Not sure if i can so if an admin sees this it can be deleted)

1 Like