TextButton does not react

I have a part which is in ReplicatedStorage (since it has to be cloned for all players client-sided)
It has a SurfaceGui adorneed to the part.
Inside the SG, there’s a textbutton I want to press. Sadly, it does not react and behaves as if it’s a frame or something like that.
When I put the part with the GUI in Workspace, the button works all fine.

I have already looked through other topics, for other’s the fixes have worked, for me although none have.

I have specific settings enabled:
AlwaysOnTop and Active.

Example Video:

Any way I could fix this…?

1 Like

Hey! Have you tried parenting the SurfaceGui to the player’s PlayerGui?

From there you set the Adornee to the part!

Do I parent it with a script? (Stupid question I know, I’ve never really worked with PlayerGui as everything I do is server-sided surfaceGuis)

If so… how do I do that?

Yeah, you’d parent it with a script because each player would have a different part. If I’m correct – I think you can just parent it within the LocalScript that you are moving the part with.

local Players = game:GetService("Players")
local Player = Players.LocalPlayer

local PlayerGui = Player:WaitForChild("PlayerGui")

local gui = pathToGui -- wherever the SurfaceGui is actually located 
local part = pathToPart -- wherever the Part is actually located
gui.Parent = PlayerGui
gui.Adornee = part

I hope this is helpful enough, sometimes it’s hard without really seeing the rest of the code!

It has been adorneed to the Part, parented to PlayerGui, although the UI does not move with the part any longer.
And the button is still unresponsive.

Here’s the code that’s used to move the part with my head.
Location: game.StarterPlayer.StarterCharacterScripts.SetHUD
image
Location of part and UI: game.ReplicatedStorage
image

Code (SetHUD)

-- Set HUD to player

local Character: Model			 = script.Parent
local CharacterHead 			 = Character:FindFirstChild("Head") :: Part

local HUDPart 		  			 = Instance.new("Part")
HUDPart.Size					 = Vector3.new(0.001, 0.001, 0.001)
HUDPart.Name 					 = "HUDWeld"
HUDPart.Transparency		     = 1
HUDPart.Position 	  			 = Vector3.new(0, 0, -3.4) + CharacterHead.Position
HUDPart.CanCollide 	  			 = false
HUDPart.CanTouch 	  			 = false
HUDPart.Parent 		  			 = CharacterHead

local Weld 			  			 = Instance.new("WeldConstraint")
Weld.Part1 			  			 = HUDPart
Weld.Part0 			  			 = CharacterHead
Weld.Parent 		  			 = HUDPart

local HUDAttachment	   			 = Instance.new("Attachment", HUDPart)

local HUD 			             = game.ReplicatedStorage.Main:Clone()
HUD.AlignPosition.Attachment1    = HUDAttachment
HUD.AlignOrientation.Attachment1 = HUDAttachment
HUD.Parent 						 = Character

If you require a game file to look at it in depth, I could send one over.