UIS.InputBegan:Connect(function(input, typing) -- when the player presses f this fires
if typing then return end
if input.KeyCode == key then
if mouse.Target ~= nil then
if mouse.Target.Parent:FindFirstChild("IsMaterial") then
local item = mouse.Target.Parent
if item ~= nil then
--Problem: When died, humanoidrootpart stays at the last place the player died
if (item.PrimaryPart.Position - humanoidRootPart.Position).magnitude < range then
print((item.PrimaryPart.Position - char.HumanoidRootPart.Position).magnitude)
if char.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
receiveEvent:FireServer(item)
end
end
end
end
end
end
end)
Whenever my character resets, the humanoid root part's position is the same before I died. How do I fix this?
