Hello!
I'm trying to disable the weapons in a player's backpack while inside the lobby. But I'm having a bit of trouble with that. I've tried a couple of different scripts, without much luck. I've tried to do this by putting a giant invisible block inside my Lobby and inserting a local script to where if the player is touching the block, their backpack will be disabled.
This is my most recent scripting attempt:
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local torso = char:WaitForChild('Torso') torso.Touched:connect(function(hit) local human = hit.Parent:FindFirstChild('Humanoid') if human.Parent.Name == 'BackpackChanger' then --the name of the block inside the Lobby. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false) end end)
Am I going about this the right way, or is there a better method? Thanks!
Your way could work, but i do have another way that might be a little easier. You could create a "Lobby" team, and then, when a player is in the Lobby team, you could disable the player's backpack. Here's an example:
function DisableBackpack() --Create a function to disable the backpack local StarterGui = game:GetService('StarterGui') StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) end for i,v in next, game.Teams.Lobby:GetPlayers() do -- Getting the players in the lobby team DisableBackpack()--Calls out the function only torwards the players in the lobby team end
Then again, you dont have to use this method, depending on your goals of the game you are making, but this is the way i would go about doing so. Please accept my answer if this helped! ;)
--Seabiscuitz