How to make imagebutton visible

I want the image buttons to be visible when the player touches a block. The image buttons do not become visible.
Not sure if this is related, but while the game is running, when I make them visible on the client mode through the properties panel, it does not work. When I switch to server mode, by clicking the visible value to on in properties it does work.

In local script:

hover.Seat.ChildAdded:connect(function(child)
	print("Printed")
	camera.CFrame = hover.Seat.CFrame * CFrame.new(0, 10, 0)
	player.CameraMinZoomDistance = 14
	upgui.Visible = true --None of gui working
	upgui.Active = true	
	dngui.Visible = true
	dngui.Active = true
	print("Printed 2")
end)
Part.Touched:Connect(function()

-- Set the uis visible

end)

Part.TouchEnded:Connect(function()

-- Set the uis to invisible

end)

Sorry, forgot to put that part in the description. I’ve edited in. The properties panel shows that visible is activated but the gui doesn’t actually become visible.

See any errors in the console?

Nope. I’m really confused because the properties panel says it’s visible.

Perhaps you’re changing their visiblity to false in another function?

Could you show me the whole code?

Sure

local player=game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local hover = workspace.Hover
camera.CameraType = Enum.CameraType.Scriptable
local upgui = game.StarterGui.Hovercc.Up
local dngui = game.StarterGui.Hovercc.Down



local w,a,s,d,up,dn

hover.Seat.ChildAdded:connect(function(child)
	print("Printed")
	camera.CFrame = hover.Seat.CFrame * CFrame.new(0, 10, 0)
	player.CameraMinZoomDistance = 14
	upgui.Visible = true --None of gui ow
	dngui.Visible = true
	print("Printed 2")
end)

hover.Seat.ChildRemoved:connect(function(child)
	player.CameraMinZoomDistance = 0.5
	upgui.Visible = false
	dngui.Visible = false
end)

And the structure is StarterGui → ScreenGui → ImageButton

I wouldn’t use TouchEnded. It can be really wacky and might not detect when the player no longer touches the part.

lol your updating startergui descendants?

try Player.PlayerGui.Hovercc.Up and Player.PlayerGui.Hovercc.Down

local upgui = Player.PlayerGui.Hovercc.Up
local dngui = Player.PlayerGui.Hovercc.Down
2 Likes

Why use .ChildAdded, may I ask?

From what I know, the seat part does not receive a new child whenever you sit on it.

Epic, thank you! That makes way more sense as well

So is this what you’re trying to do?:

  • Once player sits on seat, the specified UI is visible.

Also ChildAdded wont work pretty sure there is a property inside of the Seat that says who is sitting on it

Try

Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
end)

Ah. I’ll update it ty. At the moment though everything inside child added works when you sit in the seat or get up from it.

Oh that’s cool. I didn’t know that

Actually you’re just checking if any player sits on the Seat so the occupant could be anyone and you still change the uis visiblity to true?

1 Like

Oh yeah you’re right. I’ll have to change that by checking who the occupant is