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.
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)
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
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…
(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.
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???
“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.
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
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.
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