Help with modifying an open sourced module

hi. so i’m trying to modify this open sourced handto utility system made by @7kayoh but its made so that you have to script in some way for it to be toggled. i’m not a very experienced scripter, and this is quite advanced code for me. if someone could help me understand what to add and how i should add it, that would be amazing. heres the code for the toggle thingy

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Common = ReplicatedStorage:WaitForChild("Common")
local Modules = {}
local _UI
local Bindable = Instance.new("BindableFunction")

local function Invoke(Type)
	if _UI then
		if Type == "Toggle" then
			_UI.Properties.Toggled = not _UI.Properties.Toggled
			_UI:Deploy()
		end
	end
end

local function Init()
	local Container = Instance.new("ScreenGui")
	_UI = Modules.Cook.new(Container)
	Container.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	Bindable.Parent = script
	Container.Parent = Players.LocalPlayer.PlayerGui
	
	Bindable.OnInvoke = Invoke
	
	_UI:Deploy()
end

for _, v in pairs(Common:GetChildren()) do
	if v:IsA("ModuleScript") then
		Modules[v.Name] = require(v)
	end
end

Init()

tysm, help is greatly appreciated :revolving_hearts:

2 Likes

anyone know how to help? i would highly appreciate it if so

2 Likes

In what way are you trying to modify the script?

3 Likes

theres no way to toggle the gui, and i have to add it, which i can’t figure out

2 Likes

Reading the post for the module, it appears that:

  1. It needs to be installed through Rojo
  2. There is just a setting change to enable keyboard interaction with the UI?

Are either of these related to what you are trying to achieve?

2 Likes

i just need to make it so the keyboard can enable the ui (which idk how to do) i’ve already installed it

2 Likes

Can you please send the code located at server.UI.App.client.lua? Ill try modifying it to add the toggling thing.

What keybind would you want?

2 Likes

Hi! I really appreciate your help, thank you. The only script I see relating to this is Hander > UI > App but no client.lua. If the script your looking for is the UI app script where the toggle is, I added it to the original post.

2 Likes

I think something like this might work. It’s untested, but I feel like it should be correct

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Common = ReplicatedStorage:WaitForChild("Common")
local Modules = {}
local _UI
local Bindable = Instance.new("BindableFunction")
local UIS = game:GetService("UserInputService")

local function Invoke(Type)
	if _UI then
		if Type == "Toggle" then
			_UI.Properties.Toggled = not _UI.Properties.Toggled
			_UI:Deploy()
		end
	end
end

local function Init()
	local Container = Instance.new("ScreenGui")
	_UI = Modules.Cook.new(Container)
	Container.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	Bindable.Parent = script
	Container.Parent = Players.LocalPlayer.PlayerGui

	Bindable.OnInvoke = Invoke

	_UI:Deploy()
end

for _, v in pairs(Common:GetChildren()) do
	if v:IsA("ModuleScript") then
		Modules[v.Name] = require(v)
	end
end

UIS.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
	if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.P then -- Change Enum.KeyCode.P to whichever keycode you want
		Invoke("Toggle")
	end
end)

Init()
3 Likes

have you tried using proximity prompt?

2 Likes

it wouldn’t really make sense to use that. i’m not sure if your familiar with cafe games but its basically a hand-to gui

1 Like

alright i tried that. i really appreciate you writing the code for me you didn’t have to :heart: . it didnt work for some reason, i checked output and no errors. in the script you had, i didnt see anything with the deploy function which i assume would deploy the UI, maybe thats the issue? once again i appreciate your help a ton

2 Likes

what’s an error you’re getting?

1 Like

i’m not getting any errors at all but i press p and it dosent work

1 Like