Image button not clicking

https://gyazo.com/0c87ad65e07322bf67d4b443d398ea27

local startergui = game:GetService("StarterGui")
local screenGui = startergui:FindFirstChild("ScreenGui")

local speedpass = screenGui:FindFirstChild("speedpass")


speedpass.MouseButton1Down:Connect(function()
	print("hi")
end)

as you can see it shows my mouse is over it but when i click it, nothing prints

Try using speedpass.MouseButton1Click or speedpass.Activated

nope,does not work unfortunately

Never mind, I found the problem.

The problem is that you’re mentioning the path through “StarterGui”. But you see, when you join a game, all the gui in the StarterGui automatically gets cloned into Playerguis.

So instead try this –
game.Players.LocalPlayer.PlayerGui.Screengui.speedpass

You can check the path by testing the game in studio and clicking the drop down arrow next to Players. There you’ll see Playergui. Open it, and you’ll see all the gui is stored there. Changing properties in StarterGui won’t make any change because the Player is seeing the Gui from PlayerGui

1 Like

No, actually

game:GetService("Players").LocalPlayer.PlayerGui.speedpass

I just fixed your “typo” ;).

1 Like

How StarterGui works is it replicates it’s contents to the PlayerGui (found in the player) when they join the game. To process an event from the image button, you must reference the image button in the PlayerGui.

No actually

game.Players.LocalPlayer.PlayerGui.Screengui.speedpass