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
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
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.