I have a problem with my pick up/drop system, every time I pick up, and drop the item (parenting it on workspace) it doesn’t drop normally, in front of the player but on it’s original position (before the player has picked up the item) or it just floats in front of the player, eventhough is not anchored fyi i used this module for mouse cast ( MouseCastPlus - Creator Store )
local mCast = require(game:GetService("ReplicatedStorage").Libs.MouseCastPlus)
local UIS = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local player = game.Players.LocalPlayer
local char = player.Character
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
local cAnimation = Instance.new("Animation")
cAnimation.AnimationId = "rbxassetid://107947741475849"
local animTrack = animator:LoadAnimation(cAnimation)
local lastPart = nil
local hTable = {}
local hObject = mCast.new(hTable, 40)
local pFrame = script.Parent.PromptFrame
local hover = false
local hold = false
pFrame.Visible = false
rs.Heartbeat:Connect(function()
for v, item in workspace.Packages:GetChildren() do
table.insert(hTable, item)
end
end)
hObject:onHoverEnter(function(part)
lastPart = part
pFrame.Visible = true
pFrame.ActionText.Text = "Pick Up"
hover = true
end)
hObject:onHoverLeave(function(part)
pFrame.Visible = false
hover = false
end)
UIS.InputBegan:Connect(function(input,gp)
if not gp then
if input.KeyCode == Enum.KeyCode.E then
if hover == true and hold == false then
local tool = Instance.new("Tool")
local part = lastPart
part.Anchored = false
part.Parent = tool
part.Name = "Handle"
tool.Parent = player.Backpack
humanoid:EquipTool(tool)
animTrack:Play()
hold = true
else
local lastPackage = player.Character:FindFirstChildOfClass("Tool"):WaitForChild("Handle")
lastPackage.Parent = workspace.Packages
lastPackage.Anchored = false
lastPackage.Name = "Cardboard"
lastPackage.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-4)
humanoid:UnequipTools()
animTrack:Stop()
hold = false
end
end
end
end)
Here’s a video of the problem
robloxapp-20250107-1915380.wmv (630.0 KB)
(sorry for the video quality)
Thanks in advance!