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 ;-;
script.Parent.ClickDetector.MouseHoverLeave:Connect(function(Player) Player.GunShop.Enabled = false print("hover left") end) script.Parent.ClickDetector.MouseHoverEnter:Connect(function(Player) Player.GunShop.Enabled = true print("hover enter") end)
Since the MouseHover functions already give you which player has hovered their mouse over the click detector, you don't need to do any of that stuff we talked about in comments, you just need to get the Player in the function argument's GunShop GUI.
This script will work, and if it prints both "hover enter" and "hover left", then the only reason it doesn't work is because there's something wrong with the GunShop GUI.