Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How come a part wont be put into workspace when a player dies?

I'm trying to make a system where a gun drops when a player dies, but the gun that is in the form of a part for testing is not being cloned and put into workspace near or at the characters HumanoidRootPart Position.(the tool is going to be a mesh that looks like the tool)

local ReplicatedStorage = game:GetService("ReplicatedStorage")

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAppearanceLoaded:Connect(function(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		
		---SecondaryTool
		local Tool = Player.Backpack:FindFirstChild("M1911A1")
		
		---DropTool
		local DropTool = ReplicatedStorage:WaitForChild("DropItems"):WaitForChild("M1911Drop"):Clone()
		
		Humanoid.Died:Connect(function()
			if Player.Team.Name == "Division Black" then
				if Tool then
					DropTool.Parent = game:GetService("Workspace")
					DropTool.Position = Character:WaitForChild("HumanoidRootPart").Position
				end
			end
		end)
	end)
end)

1 answer

Position is not a property of a tool?

Were there any other errors?

The only solution I can think of is

 DropTool.Model:SetPrimaryPartCFrame(CFrame.new(Character:WaitForChild("HumanoidRootPart").CFrame))

Just make sure you have a Primary Part set for the model and change .Model to whatever your tool's model is called.

2 comments

0

I kinda misworded the "tool" isn't really like a tool its just what I call it in reality its going to be a mesh or a part. also I get no errors. Sorry for the confusion.

0

You can try adding prints around your code to see when it stops.

This discussion is preserved as it was. New answers, comments, and votes are closed.