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

Server script isn't operating certain functions with Filtering Enabled?

I made a script that creates a TextButton with Instance.new() and connects an event to the button.

		local gui = Instance.new("ScreenGui")
		local frame = Instance.new("Frame")
		local nobutton = Instance.new("TextButton")
		local yesbutton = Instance.new("TextButton")
		local watermark = Instance.new("TextLabel")
		local warning = Instance.new("TextLabel")
		
		gui.Name = "Emergency Music Clear"
		gui.Parent = plr.PlayerGui
		
		frame.BorderColor3 = Color3.fromRGB(255,0,0)
		frame.BorderSizePixel = 5
		frame.BackgroundColor3 = Color3.fromRGB(0,0,0)
		frame.BackgroundTransparency = 0.5
		frame.Position = UDim2.new(0.5,-125,0.5,-50)
		frame.Size = UDim2.new(0,250,0,100)
		frame.Parent = gui
		--VVButton TWO
		nobutton.Name = "Cancel"
		nobutton.BackgroundColor3 = Color3.fromRGB(255,90,90)
		nobutton.BorderColor3 = Color3.fromRGB(255,0,0)
		nobutton.BorderSizePixel = 4
		nobutton.Position = UDim2.new(0.7,-25,0.8,-12)
		nobutton.Size = UDim2.new(0,50,0,25)
		nobutton.FontSize = Enum.FontSize.Size14
		nobutton.Text = "Cancel"
		nobutton.TextStrokeTransparency = 1
		nobutton.Font = Enum.Font.SourceSansBold
		nobutton.Parent = frame
		nobutton.TextColor3 = Color3.fromRGB(0,0,0)
		--VVButton ONE
		yesbutton.Name = "Cancel"
		yesbutton.BackgroundColor3 = Color3.fromRGB(44,88,0)
		yesbutton.BorderColor3 = Color3.fromRGB(27,42,53)
		yesbutton.BorderSizePixel = 0
		yesbutton.Position = UDim2.new(0.3,-25,0.8,-12)
		yesbutton.Size = UDim2.new(0,50,0,25)
		yesbutton.FontSize = Enum.FontSize.Size14
		yesbutton.Text = "Confirm"
		yesbutton.TextStrokeTransparency = 1
		yesbutton.Font = Enum.Font.SourceSansBold
		yesbutton.Parent = frame
		yesbutton.TextColor3 = Color3.fromRGB(0,0,0)
		
		watermark.Name = "Watermark"
		watermark.BackgroundTransparency = 1
		watermark.Position = UDim2.new(0.1,0,-0.15,0)
		watermark.Size = UDim2.new(0,200,0,50)
		watermark.Font = Enum.Font.SciFi
		watermark.FontSize = Enum.FontSize.Size18
		watermark.Text = "TroiTech"
		watermark.TextColor3 = Color3.fromRGB(189,255,253)
		watermark.Parent = frame
		
		warning.Name = "Warning"
		warning.BackgroundTransparency = 1
		warning.Position = UDim2.new(0.1,0,0.1,0)
		warning.Size = UDim2.new(0,200,0,50)
		warning.Font = Enum.Font.SourceSansItalic
		warning.FontSize = Enum.FontSize.Size24
		warning.Text = "Remove global sounds?"
		warning.TextColor3 = Color3.fromRGB(255,255,255)
		warning.Parent = frame
		warning.TextWrapped = true
		
		nobutton.MouseButton1Down:connect(function()
			print("Decline")
			gui:Destroy()
		end)
		yesbutton.MouseButton1Down:connect(function()
			print("Accept")
			for _,v in pairs(game:GetService("Workspace"):GetChildren()) do
				if v:IsA("Sound") then
					v:Destroy()
				end
			end
			gui:Destroy()
		end)

My issue is that when I use Filtering Enabled, the button stop working. This is a server script inside ServerScriptService. I'm honestly clueless about why it isn't working.

2 comments

0

Is there any errors in the output?

0

No errors

1 answer

✓ Accepted answer

Alight, so I've worked with this and I came to see that you can just make the GUI locally using a RemoteEvent, and that basically fixes it.

SeverScript:

-- The RemoteEvent is in Lighting and named 'MakeGui'
game.Players.PlayerAdded:connect(function(player)
local Lighting = game:GetService("Lighting") -- Gets the lighting service
lighting.MakeGui:FireClient(player) -- Fires the client function from the server!
end)

LocalScript:


local plr = game.Players.LocalPlayer

game.Lighting.MakeGui.OnClientEvent:connect(function() -- Connects the RemoteEvent to fire the below code when called.

-- Everything below here is basically what you already had.
	local gui = Instance.new("ScreenGui")
	local frame = Instance.new("Frame")
	local nobutton = Instance.new("TextButton")
	local yesbutton = Instance.new("TextButton")
	local watermark = Instance.new("TextLabel")
	local warning = Instance.new("TextLabel")
	--
	gui.Name = "Emergency Music Clear"
	gui.Parent = plr:WaitForChild("PlayerGui")
	--
	frame.BorderColor3 = Color3.fromRGB(255,0,0)
	frame.BorderSizePixel = 5
	frame.BackgroundColor3 = Color3.fromRGB(0,0,0)
	frame.BackgroundTransparency = 0.5
	frame.Position = UDim2.new(0.5,-125,0.5,-50)
	frame.Size = UDim2.new(0,250,0,100)
	frame.Parent = gui
	--VVButton TWO
	nobutton.Name = "Cancel"
	nobutton.BackgroundColor3 = Color3.fromRGB(255,90,90)
	nobutton.BorderColor3 = Color3.fromRGB(255,0,0)
	nobutton.BorderSizePixel = 4
	nobutton.Position = UDim2.new(0.7,-25,0.8,-12)
	nobutton.Size = UDim2.new(0,50,0,25)
	nobutton.FontSize = Enum.FontSize.Size14
	nobutton.Text = "Cancel"
	nobutton.TextStrokeTransparency = 1
	nobutton.Font = Enum.Font.SourceSansBold
	nobutton.Parent = frame
	nobutton.TextColor3 = Color3.fromRGB(0,0,0)
	--VVButton ONE
	yesbutton.Name = "Confirm"
	yesbutton.BackgroundColor3 = Color3.fromRGB(44,88,0)
	yesbutton.BorderColor3 = Color3.fromRGB(27,42,53)
	yesbutton.BorderSizePixel = 0
	yesbutton.Position = UDim2.new(0.3,-25,0.8,-12)
	yesbutton.Size = UDim2.new(0,50,0,25)
	yesbutton.FontSize = Enum.FontSize.Size14
	yesbutton.Text = "Confirm"
	yesbutton.TextStrokeTransparency = 1
	yesbutton.Font = Enum.Font.SourceSansBold
	yesbutton.Parent = frame
	yesbutton.TextColor3 = Color3.fromRGB(0,0,0)
	--
	watermark.Name = "Watermark"
	watermark.BackgroundTransparency = 1
	watermark.Position = UDim2.new(0.1,0,-0.15,0)
	watermark.Size = UDim2.new(0,200,0,50)
	watermark.Font = Enum.Font.SciFi
	watermark.FontSize = Enum.FontSize.Size18
	watermark.Text = "TroiTech"
	watermark.TextColor3 = Color3.fromRGB(189,255,253)
	watermark.Parent = frame
	--
	warning.Name = "Warning"
	warning.BackgroundTransparency = 1
	warning.Position = UDim2.new(0.1,0,0.1,0)
	warning.Size = UDim2.new(0,200,0,50)
	warning.Font = Enum.Font.SourceSansItalic
	warning.FontSize = Enum.FontSize.Size24
	warning.Text = "Remove global sounds?"
	warning.TextColor3 = Color3.fromRGB(255,255,255)
	warning.Parent = frame
	warning.TextWrapped = true
	
	nobutton.MouseButton1Down:connect(function()
    print("Decline")
    	gui:Remove()
	end)

	yesbutton.MouseButton1Down:connect(function()
    print("Accept")
    for _,v in pairs(game:GetService("Workspace"):GetChildren()) do
        if v:IsA("Sound") then
            v:Remove()
        end
    end
    gui:Destroy()
	end)
end)

Hope this helped! :D

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