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?
Make sure your tool is in StarterPack.
Disable the Backpack from StarterGui
1 | 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
1 | game.Players.PlayerAdded:connect( function (player) |
2 | player.CharacterAdded:connect( function (character) |
3 | player.Backpack:WaitForChild( 'TOOLNAME' ).Parent = character |
4 | end ) |
5 | end ) |
01 | wait( 0.001 ) |
02 | EnableBackpackGui = false --Change it to true if you want to keep backpack icon |
03 | Weapon = script.Parent.Name --Place it in a tool |
04 | local player = game:GetService( "Players" ).LocalPlayer --Use a local script |
05 | local mouse = player:GetMouse(); --Get mosue |
06 | local char = player.Character --Character |
07 | local tool = player.Backpack:FindFirstChild( "" ..Weapon.. "" ) --Find tool |
08 | db = 1 |
09 | while wait() do |
10 | if char then |
11 | game.StarterGui:SetCoreGuiEnabled( 2 ,EnableBackpackGui) --Check if Icon is enabled. |
12 | for i,v in ipairs (char:GetChildren()) do |
13 | if v.className ~ = "" ..Weapon.. "" then |
14 | wait() |
15 | if db = = 1 then |