Please note this is a old post, so the time when I posted this I was a noob, please don't complain
Ok, I checked the script, that wasn't any error, but I have no idea why the script doesn't work.
script.Parent.ClickDetector.MouseHoverLeave:Connect(function(Player)
game.StarterGui.GunShop.Enabled = false
end)
script.Parent.ClickDetector.MouseHoverEnter:Connect(function(Player)
game.StarterGui.GunShop.Enabled = true
end)
I'd think the game does error, BUT I tested another script like this, it WORKED??! :
script.Parent.ClickDetector.MouseHoverLeave:Connect(function(Player)
print("Hover out")
end)
script.Parent.ClickDetector.MouseHoverEnter:Connect(function(Player)
print("Hover in")
end)
Every help is appreciated.
Edit :
script.Parent.ClickDetector.MouseHoverLeave:Connect(function(Player)
game.Players.LocalPlayer.PlayerGui.GunShop.Enabled = false
end)
script.Parent.ClickDetector.MouseHoverEnter:Connect(function(Player)
game.Players.LocalPlayer.PlayerGui.GunShop.Enabled = true
end)
This script won't work for me ;-;

9 comments
Please help, I founded the working script at https://developer.roblox.com/en-us/api-reference/event/ClickDetector/MouseHoverEnter
StarterGui is cloned into playerGUI when you join so you need to make the script change the local players PlayerGUI not starterGui
Best thing to do when working with screen guis is to run the game and either just do small edits there while it is running (which I don't recommend) or use snipping tool to take a picture of what the hierarchy looks like in-game.
Omg thx for helps, And can you do the script for me? I tested a lot but all doesn't work. Thanks you :D
We've given you everything you need to fix it yourself, there's no need for us to do it for you. Just change the hierarchy in your script from "game.StarterGui" to "game.Players.LocalPlayer.PlayerGui"
That doesn't work for me ;-; so please make a clearer explains and let me accept the answer too ;c
WARNING : THE PLAYER GUI MUST GET :WaitForChild("PlayerGui") or it will not works
But plz make it an answer ;c
You actually don't need to do WaitForChild unless you are unsure if the character has loaded in.