Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make LocalPlayer drop an item from a local script?

Asked by 5 years ago

As the title says I need to make a localscript drop an item how would I do this?

1 answer

Log in to vote
0
Answered by
starmaq 1290 Moderation Voter
5 years ago
Edited 5 years ago

This is not a request site, we don't make you scripts, we try to help you fix you're already-made script. So please next time take a shot at doing this, and if it doesn't work come here and we'll help. I'll give you a rough idea of what you want to do.

You can't force the player to drop an item, since dropping items only happens if the backspace button is pressed. But what we can do is, since the tools the player have are stored within locaplayer.Backpack, what we can do is re-parent them (to workspace obviously, we might as well change there position so they are dropped in front of the player) so they are no longer there which is really the equivilant of dropping them. Also when a tool is equipped it is automatically re-parented to the character and it's no longer in localplayer.Backpack. It's just your choice to chose when to drop the item.



local player = game.Players.LocalPlayer for i, v in pairs(player.Backpack:GetChildren() do v.Parent = workspace v.Position = player.Character.Head.Position + Vector3.new(4, 0, 0) end
0
that will only be visible on client side as im trying to do this from a localscript do i need to make a removeevent if i want to? iranathan 7 — 5y
0
Yeah starmaq 1290 — 5y
0
I am doing this in my current game , being developed (but using a custominventory system..) anyway, I drop items with a remote event after its picked from inventory JasonTheOwner 391 — 5y
Ad

Answer this question