Item drop at a weird position

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!

1 Like

well im not seeing any communication between the server and the clien so my guess is:
when you drop the item the server doesnt replicate the position of the current item thay is being dropped so what would i do is a way to send the position of the item to the server via a remote event

1 Like

i recommend it to use a remote event maybe because you made the script in client so the object that is dropped will also be in client so the server wont see it USE REMOTE :))

oh my bad i didnt saw that someone reply it same before Sorry @xxmanado

2 Likes

i modified the script a little bit and added a remote event and it works now tysm!

1 Like

ty for your help too (someone replied before you so i read that first but still thanks for your help i appreciate it)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.