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

How is it possible to force equip something?

Asked by 6 years ago

Hey there, sorry to bother, but I'm looking for a way to force equip something in the player's backpack, I want to have a flashlight in the player's hand but I want them to not be able to de-equip it. Is there a way to do that?

0
Try welding the flashlight to their hand and not make it a tool. CaptainAlien132 225 — 6y
0
@CaptainAlien132 The flashlight has it's own scripts, for hand movement and stuff. aoaoaoaoa00 4 — 6y
0
If it HAS to be a tool, you can use :EquipTool() on the humanoid with a loop. The player can still kinda unequip it but only for a very short moment depending on the loop. User#20279 0 — 6y
0
I second that. Just modify the scripts to work with it. Meltdown81 309 — 6y

3 answers

Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago

Make sure your tool is in StarterPack.

Disable the Backpack from StarterGui

game.StarterGui:SetCoreGuiEnabled("Backpack", false)

When the player joins the game, take the tool from their backpack, and move it in the player's character

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        player.Backpack:WaitForChild('TOOLNAME').Parent = character
    end)
end)
Ad
Log in to vote
1
Answered by 6 years ago

Use Equip Tool

0
Definitely the answer I am looking for aoaoaoaoa00 4 — 6y
Log in to vote
0
Answered by 4 years ago
wait(0.001)
EnableBackpackGui = false  --Change it to true if you want to keep backpack icon
Weapon = script.Parent.Name --Place it in a tool
local player = game:GetService("Players").LocalPlayer --Use a local script
local mouse = player:GetMouse(); --Get mosue
local char = player.Character --Character
local tool = player.Backpack:FindFirstChild(""..Weapon.."") --Find tool
db=1
while wait() do
if char then
game.StarterGui:SetCoreGuiEnabled(2,EnableBackpackGui) --Check if Icon is enabled.
for i,v in ipairs(char:GetChildren()) do
if v.className ~= ""..Weapon.."" then
wait()
if db == 1 then
player.Character.Humanoid:EquipTool(tool) --Force equip tool
db=2
end
end
end
script.Parent.Unequipped:connect(function() --If unequipped
db=1 --Make equipped
end)
end
end

Answer this question