SurfaceGUI becomes uninteractive when used in a tool in a players inventory

  1. What do you want to achieve?
    I’m trying to make a tool with a screen, which is obviously one of the perfect use cases for SurfaceGUI’s.

  2. What is the issue?
    For some reason, the SurfaceGUI and its UIObjects work perfectly as intended when the tool is left on the floor and not in the players inventory, but as soon as i pick it up, the SurfaceGUI doesn’t respond at all to any interactions??? in the screenshots i used a TextButton to show the difference, however there is also a ScrollableGUI on the left of the SurfaceGUI which doesnt work either?? (i’d like to also note i tried testing to see if i messed something up with my tool by making a part in a tool called Handle, added a SurfaceGUI and TextButton to it, and this test showed the same response)

image

image

  1. What solutions have you tried so far?
    I searched through the properties for the SurfaceGUI (admittedly i just skimmed through it because I doubt it would be that) and even set the Adornee to the screen part and then put the SurfaceGUI into the StarterGUI, however this doesnt work either? (let alone even if it did i wouldnt be able to try this for my actual tool) I also tried searching up on Youtube to see if there was a step i was a required step for this scenario i was missing but nothing
1 Like

Bumping topic; I’d like to also mention the surface gui works if i move the part outside of the tool and into workspace, meaning that it is DEFINITELY being parented to a tool in a player’s inventory that breaks it…

I would post your script that is used to control the screen and its buttons, as im sure the location changes once its in the players backpack.

1 Like

(sorry for the slow reply) what do you mean by this? i only have a script inside the tool that detects button clicks, and yes the tool does move inbetween the players backpack and model. The problem is that when its inside of the player model, it seemingly breaks the UIObjects and doesnt let them function properly.

Post your script in here, so we can determine if the script is the issue.

Also, have u seen this post?:

Also, try lowering this property considerably, so that the tool click isnt interfering with the surface gui click:

1 Like
script.Parent:WaitForChild("ScreenPart"):WaitForChild("ScreenGUI"):WaitForChild("Frame"):WaitForChild("TextButton").MouseButton1Click:Connect(function()
	print("CHICKEN!")
end)

image

this is basically as much detail as i can give lmao

in response to the link you sent, i tried making the part with the SurfaceGUI as thick as possible, 0.481 studs, no difference :tired_face:

OOH, I found something while testing, im not sure if setting the ToolPunchThroughDistance helped as it was originally 0 and i set it to its max, but i found out that while in server mode i can click on the button but not scroll in the ScrollableGUI???

image

“SurfaceGuis must be descendants of PlayerGui in order to know which player is interacting with it.”

Im pretty sure once it is in your player backpack, it is no longer in the PlayerGui… so once you equip tool, you can then clone the surface gui to the playergui and interact with it then.

1 Like

hi again, sorry for the 8 hour delay i want to sleep lol i made a script for this and its now working, here is what i wrote: (in a localscript)

local LocalSurfaceGUI = nil
local function CloningSurfaceGUI()
	local PlrGUIChildren = playerGUI:GetChildren()
	local Allowed = true
	for _, Child in pairs(PlrGUIChildren) do
		-- if surface gui found, there already is one.
		if Child:IsA("SurfaceGui") then Allowed = false break end
	end
	if Allowed then
		LocalSurfaceGUI = Screen.ScreenGUI:Clone()
		LocalSurfaceGUI.Parent = playerGUI
		LocalSurfaceGUI.Adornee = Screen
		LocalSurfaceGUI.AlwaysOnTop = false
		warn("add")
	end
	LocalSurfaceGUI.Enabled = true
	Screen.ScreenGUI.Enabled = false
end
CloningSurfaceGUI()

local function RemoveLocalSurfaceGUI()
	playerGUI:FindFirstChildWhichIsA("SurfaceGui"):Destroy()
	Screen.ScreenGUI.Enabled = true
	warn("remove")
end

except theres one last issue; for some reason i can only click it when i set the SurfaceGUI (in the PlayerGUI) to AlwaysOnTop? I thought it was the models i made for the tool blocking the UIObjects, then again though, the serverside copy parented directly to the part in the tool works as intended without needing to be AlwaysOnTop, so im not sure whats going on here. I tried seeing if maybe the serverside and local SurfaceGUI’s were clashing to not let me click on the local one, but as shown in the code i sent disabling the serverside one parented to the part in the tool doesnt change anything…

sorry if this is annoying you by the way i get this might be irritating to deal with because its definitely irritating me lmao

same results when i manually try moving the SurfaceGUI in that test brick into the PlayerGUI using the Explorer tab lmao

1 Like

bumping incase someone else sees and can help me out, i cant really work on this tool until this bug is fixed :confused:

1 Like

bumping… i dont really know what else to say, please help, i dont know what else i could try

1 Like

If you have tried all the properties, then what I would do is to create the UI holding part outside the character (like in workspace) but welded to the tool.

1 Like

honestly yeah i’ll probably just do this, i tested to see if this would work and it did but it felt kinda like a last resort because of how buggy it might become, but whatever i’ll just try work with it ig

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.