Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is client sided scripts that turn the blur on also being serversided?

Asked by 6 years ago
Edited 6 years ago

So I was making a settings gui window, and it worked totally fine in roblox studio, but when I went to play with my dev team, we noticed something strange. The blur was serversided, which meaned that if I turned the blur all the way to 100 with the gui, it'll show it to other screens, then if somebody would've turned it up it would automatically convert to his amount of blur. Which made me ask myself is this a bug or not? Script:

add.MouseButton1Click:connect(function()
    if script.Parent.BlockedFrame.Visible == false then
        sizeofblur = sizeofblur + 1
        game.Lighting.Blur.Size = sizeofblur
        script.Parent.SizeBlur.Text = sizeofblur
        if sizeofblur == 100 then
            add.Visible = false
        elseif  sizeofblur == 2 then
            Sub.Visible = true
        end

    end
end)

Sub.MouseButton1Click:connect(function()
    if script.Parent.BlockedFrame.Visible == false then
        sizeofblur = sizeofblur - 1
        game.Lighting.Blur.Size = sizeofblur
        script.Parent.SizeBlur.Text = sizeofblur
        if sizeofblur == 1 then
            Sub.Visible = false
        elseif sizeofblur == 99 then
            add.Visible = true
        end
    end

end)

1 answer

Log in to vote
0
Answered by 6 years ago

Is your game FilteringEnabled? LocalScripts are able to edit serverside instances when it is disabled. There are ways of getting around this, though.

Usually when someone uses a blur in a GUI, they create the blur within workspace.CurrentCamera. This insures that it is only blurring out the local player's screen.

Doing this would result in the following code:

add.MouseButton1Click:Connect(function()
    if not script.Parent.BlockedFrame.Visible then
        sizeofblur = sizeofblur + 1
        Blur = Instance.new("BlurEffect")
        Blur.Parent = workspace.CurrentCamera
        Blur.Size = sizeofblur
        script.Parent.SizeBlur.Text = sizeofblur
        if sizeofblur == 100 then
            add.Visible = false
        else
            Sub.Visible = true
        end
    end
end)

Sub.MouseButton1Click:Connect(function()
    if not script.Parent.BlockedFrame.Visible then
        sizeofblur = sizeofblur - 1
        Blur.Size = sizeofblur
        script.Parent.SizeBlur.Text = sizeofblur
        if sizeofblur == 1 then
            Sub.Visible = false
        elseif sizeofblur == 99 then
            add.Visible = true
        end
    end
end)

Hopefully this helps.

0
Okay, that seems quite promising. I'll accept the answer. guidable 42 — 6y
Ad

Answer this question