This is a server script. Its inside a click detector, and plays a sound when a player hovers their mouse over the detector. It works 100% fine in studio, but not in an online server. Filtering Enabled is off.
local Players = game:GetService('Players')
local randomID = math.random(1, 2)
local Sound1 = "rbxassetid://597286725"
local Sound2 = "rbxassetid://314678645"
function random_Sound(scareSound)
if scareSound.Playing then
return
end
randomID = math.random(1, 2)
if randomID == 1 then
scareSound.SoundId = Sound1
scareSound:Play()
elseif randomID == 2 then
scareSound.SoundId = Sound2
scareSound:Play()
end
end
function onLook(player)
if player and Players:FindFirstChild(player.Name) then
local scareSound = player.PlayerGui.Main.Static.LookScare
random_Sound(scareSound)
end
end
function leave(player)
print(player.Name)
end
script.Parent.MouseHoverEnter:connect(onLook)
script.Parent.MouseHoverLeave:connect(leave)

1 comment
convert it into a local script, try making it compatible with filtering enabled