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

How does one make a tool Un-droppable?

Asked by
Xduel 211 Moderation Voter
10 years ago

I have a Tool that I would like to make UnDroppable when pressing Backspace, in which the tool will not be affected upon pressing backspace. I first tried setting the property in the tool "CanBeDropped" to false, but I've realized upon pressing Backspace it can still be unequipped through inventory. I then experimented with this script for a while:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(key)
    if key:byte() == 8 then -- 8 is equal to the Backspace Key
        --insert code here
    end
end)

After some testing, though, I noticed this script would run after the tool was dropped, making it useless. So is there a CoreScript in the tool I can mess with to make the tool Un-droppable? Or can I make my script run before the Backspace button is pressed and un-equipping the tool? All answers very much appreciated, thank you. ~Xduel

0
There's actually a property that does just what you want. http://wiki.roblox.com/index.php?title=CanBeDropped_(Property) Perci1 4988 — 10y
0
I said in the beginning of my explanation I tried that, and it did not do what I was intending on it to do. Xduel 211 — 10y
0
Oh my bad. Perci1 4988 — 10y
0
There is a EquipTool method on humanoid. Maybe if this script is inside a LocalScript under the tool line 5 would Player.Character:WaitForChild("Humanoid"):EquipTool(script.Parent) M39a9am3R 3210 — 10y
0
That made the tool (when dropped) equip to another tool in the players backpack. That does seem to be down the right track, though. Xduel 211 — 10y

Answer this question