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

Is it possible to prevent a player from unequipping a tool?

Asked by 7 years ago
Edited 7 years ago

I want this because if I put my tool away while using it, it results in an error, a way to stop it erroring would also be an acceptable answer.

0
There's a property on tools that says something along the lines of "CanBeDropped" un-tick it. Azarth 3141 — 7y
0
That's not what I want, I want to make it so it's impossible to unequip the tool while using it, not drop it. I don't know if this is even possible, I'm asking if it is. crabbyninja 58 — 7y
0
You could always weld whatever you are using on your character. However, this means that you aren't handling with tools anymore. WingedHorizen201 124 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

I don't know of any other way other than a loop. So lets do this:

while true do
    wait()
    if game.Players.LocalPlayer.Backpack:FindFirstChild("RocketLauncher") 
        then game.Players.LocalPlayer.Backpack.RocketLauncher.Parent = game.Players.LocalPlayer.Character
        end
    end

Replace "RocketLauncher" with your tool name. When a tool enters the players character, the character equips it.

You may still receive an error because the player is able to de-equip the tool, however this is less than a second.

While making this loop in studio, I was only able to get it to work when using "FindFirstChild" Other more conventional methods exists.

Ad

Answer this question