I was testing this script below in the play solo mode(F5) in studio and it worked perfectly fine, but when I tested it in the server mode in studio, it did not work. I can't figure this out.
local mouse = game.Players.LocalPlayer:GetMouse()
local gui = script.Parent:FindFirstChild("Gui")
if mouse then
script.Parent.MouseEnter:connect(function()
if gui then
gui.Visible = true
end
end)
script.Parent.MouseLeave:connect(function()
if gui then
gui.Visible = false
end
end)
end

2 comments
make sure the script is a local script
Yes, it is.