I'm attempting to make a script that allows you to pick something up via welding the object to the player's hand, the pickup portion of the script works perfectly, but the drop portion has some bugs.
If the designated drop button (backspace) is pressed while nobody is holding it, and then somebody picks it up and tries to drop it, nothing happens.
If someone is already holding the object and somebody else presses backspace, then the holder is unable to drop it.
Here's the script:
game.ReplicatedStorage:FindFirstChild("CoreFireEventDrop#CFED").OnServerEvent:Connect(function(player) if debounce then debounce = false if welded and holder and holder.Name == player.Name then loadtrack:Stop() track:Destroy() print(holder.Name) holder.Humanoid.WalkSpeed = 16 holder.Humanoid.JumpPower = 50 holder = nil for i,v in pairs(core.Hitbox:GetChildren()) do if v:IsA("Weld") and v.Name == "CoreHold" then v:Destroy() end end welded = false pickup = false wait(.5) pickup = true debounce = true end end end)
The Input is used in a local script which fires the server to drop the ball. The welded is if there are welds currently on the player's hand, and holder is the player who is currently holding the object.
Thanks for any help you can give.