Why my character position is not updating?

I don’t know why my position of character is not updating. When i create a part and not die this script work perfect, but when i die this part is create on position where i have died not where am i standing ​now.
What can i do to fix it?

local tool = script.Parent
local players = game:GetService('Players')
local ppl = players.LocalPlayer
local Character = ppl.Character or ppl.CharacterAdded:Wait()
tool.CanBeDropped = true
tool.ManualActivationOnly = false
tool.RequiresHandle = false
tool.Activated:Connect(function()
	local part = Instance.new("Part")
	part.Parent = game.Workspace
	part.Anchored = true
	part.CanCollide = false
	part.Transparency = 0.5
	part.Size = Vector3.new(10,0.01,10)
	part.CastShadow = false
	part.Position = Character.HumanoidRootPart.Position + Vector3.new(0,40,0)
end)

you could try updating the character whenever the tool is activated:

tool.Activated:Connect(function()
local Character = ppl.Character or ppl.CharacterAdded:Wait()

	local part = Instance.new("Part")
	part.Parent = game.Workspace
	part.Anchored = true
	part.CanCollide = false
	part.Transparency = 0.5
	part.Size = Vector3.new(10,0.01,10)
	part.CastShadow = false
	part.Position = Character.HumanoidRootPart.Position + Vector3.new(0,40,0)
end)
1 Like

That’s true i am so dumb :sweat_smile:
Thank u for help :hearts:

1 Like

ur welcome! :slight_smile: thirtycharacterssss