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

How do I make a player hold a tool while also not showing any of the overhead UI?

Asked by 5 years ago

I know how to cover the backpack and chat UI's ~~~~~~~~~~~~~~~~~ local startergui = game:GetService('Startergui') startergui:SetCore(Enum.CoreGuiEnabled, false) --I think I wrote that wrong lol ~~~~~~~~~~~~~~~~~

But now I cannot equip tools. If you want a reference for this to compare it to guns in phantom forces. Are they tools? Or is it just creating an instance that is offset from the local player using them?

1 answer

Log in to vote
0
Answered by
xPolarium 1388 Moderation Voter
5 years ago
Edited 5 years ago

Make sure to take a look at this post to see how to properly format on ScriptingHelpers. You also have the Preview tool when writing out a question to see how it looks before you post.

Your code formatted correctly:
local startergui = game:GetService('Startergui') 
startergui:SetCore(Enum.CoreGuiEnabled, false) --I think I wrote that wrong lol 

First, your code doesn't do anything because it's wrong. :SetCore(), a function of StarterGui, that allows you to use Roblox CoreScripts. It does not take Enum.CoreGuiEnabled when such an Enum doesn't exist.

You probably mean to use :SetCoreGuiEnabled() to toggle CoreGui. An example disabling all CoreGuiTypes can be done as:

local StarterGui = game:GetService('StarterGui')
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) 

The above disables all including the Backpack that you speak of. When you disable the Backpack with this method, it also disabled the inventory or 'hotbar' for the player. To get around this you could use the :EquipTool() function from the Humanoid to equip a Tool object for the player.

:EquipTool()


Last thing is that Phantom Forces definitely uses their own custom tool system apart from the default Tool object that Roblox provides. Making your own custom tool system would provide more functionality depending on how you make it.

You'll need to experiment with UserInputService or ContextActionService to get player input and make your own functions to un/equip.

Let me know if I missed anything or you need something explained.
0
I already know userinput service and contextactionservice. I was just wondering how as I am making a FPS but no you got everything I needed! Dev_Coda 31 — 5y
Ad

Answer this question