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

Can you make it so you cant unequip a weapon while something is happening?

Asked by 6 years ago

I am trying to make a fishing game but if the person unequips the fishing pole while fishing everything go bonkers.

Is there a way i can make an item unequippable during a period? or even forever?

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Just use something simple like this

    local tool = script.Parent
tool.Unequipped:Connect(function()

local forceequip = true
local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local Humanoid = player.Character:FindFirstChild('Humanoid')

    if forceequip == true then
        Humanoid:EquipTool(tool)
    end
end)

Consider accepting this answer if it helped you as it will give us both reputation

Or you could disable the backpack but i don't think you want that.

0
wouldnt that still unequip the tool and then re-eqeuip it really fast? PoePoeCannon 519 — 6y
0
im looking for something where they literally cannot unequip it PoePoeCannon 519 — 6y
0
I think this allows the player to unequip the tool at an instant and re-equip it instantaneously. I would suggest trying this script and if things still "go bonkers," let us know. RAYAN1565 691 — 6y
0
Then the only option i see is to temporary disable the backpack Timmerman73 85 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Workspace.Player1.Humanoid:EquipTool(Workspace.FishingPole)

I'm pretty sure you can just run this at any instance where you want the tool to be equipped forcefully. You can then use UnEquip to end it, and give the player back the choice on whether or not to equip through their backpack. (This is usually used for avoiding animation cancels or interrupting cut-scenes, which might be what you're looking for.)

Answer this question