Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My script doesn't work in a online server but only works in studio mode?

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

1

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

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.