Hello!
I have a slight issue with my game…
I have a script that will hide the inventory GUI, but the player can still press the hotkey and it will work.
I am wondering how I can completely disable the inventory.
Hello!
I have a slight issue with my game…
I have a script that will hide the inventory GUI, but the player can still press the hotkey and it will work.
I am wondering how I can completely disable the inventory.
Create a LocalScript in StarterPlayerScripts:
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
That hides it, not disable it.
Why not just move all tools out of the player’s backpack/hand and then move them back?
You could try to unequip the player’s tools every time a descendant is added to the player’s character. Example
character.DescendantAdded:Connect(function()
humanoid:UnEquipTools()
end
Thanks, I will try it!
(30 ch limittt)
I tried it, and it gives errors.
One more thing, would this go in StartPlrScript?
This runs in any localscript, and would theoretically work in a serverscript. While yes, this can certainly work in StarterPlayerScripts, it can also work anywhere else.
Im getting an error, ideas?
local character = game.Workspace:FindFirstChild(PlayerName)
local humanoid = game.Workspace:FindFirstChild(PlayerName).Humanoid
character.DescendantAdded:Connect(function()
humanoid:UnEquipTools()
task.wait(0.3)
end)
UnEquipTools is not a valid member of Humanoid "Workspace.Ur_Dadeyyyyyy.Humanoid" - Client - LocalScript:13
It appears in my previous reply I misspelled “UnequipTools” as “UnEquipTools.” Decapitalize the E and it shouldn’t error.
It works… Kinda.
It spams the following error:
17:55:15.630 ▶ Something unexpectedly tried to set the parent of Mp5 to Backpack while trying to set the parent of Mp5. Current parent is Ur_Dadeyyyyyy. (x4999) - Studio
Did you make sure the inventory script does not execute the StarterGui:SetCoreGuiEnabled function when the player presses a hotkey? I am pretty sure this function disables or enables the inventory entirely. Seek for the lines such as:
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) -- enable inventory
I am honestly confused.
In my script, there is one instance of setting the backpack to false.
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
Does that help?
No. It seems like something sets the Backpack to true so you should find it and exclude.
I have looked through every script in my game and found nothing.
Do you think it would be a better idea to unequip the item, as @Lit_skillzYT recommended?
His/Her script works, however, it spams the following warning in the console.
12:25:44.663 Something unexpectedly tried to set the parent of Mp5 to Backpack while trying to set the parent of Mp5. Current parent is Ur_Dadeyyyyyy. - Studio
local LPlayer = game.Players.LocalPlayer
local PlayerName = LPlayer.Name
while true do
task.wait(0.1)
local character = game.Workspace:FindFirstChild(PlayerName)
local humanoid = game.Workspace:FindFirstChild(PlayerName).Humanoid
character.DescendantAdded:Connect(function()
print("equ")
humanoid:UnequipTools()
task.wait(0.3)
end)
end
Replace it with this for less warnings and lags:
local LPlayer = game.Players.LocalPlayer
local PlayerName = LPlayer.Name
local character = game.Workspace:FindFirstChild(PlayerName)
local humanoid = character:WaitForChild("Humanoid")
character.DescendantAdded:Connect(function()
task.wait()
humanoid:UnequipTools()
end)
Close.
Players.Ur_Dadeyyyyyy.PlayerScripts.LocalScript:8: attempt to index nil with 'WaitForChild' - Client - LocalScript:8
local character = game.Workspace:WaitForChild(PlayerName)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.