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

Need help with changing blur by a script?

Asked by 4 years ago

So I'm making a game about space and I want to make an astronaut helmet blur effect, but the effect isn't working. I put the blur in lighting as well. Can anyone help me?

--// This is a local script.
while true do
    for i = 0, 8, 1 do
        script.Parent.Size = i
        wait()
    end
    wait(1)
    for i = 8, 0, -1 do
        script.Parent.Size = i
        wait()
    end
    wait(1)
end

Output:

literally nothing

1 answer

Log in to vote
3
Answered by
Azarth 3141 Moderation Voter Community Moderator
4 years ago

Scripts don't run in lighting and since it's a per player thing, you'll want it to be a LocalScript placed on the client. User StarterPlayerScripts and a RemoteEvent to activate it.

local Blur = game:GetService("Lighting"):WaitForChild("Blur")
local TweenService = game:GetService('TweenService')


local Speed = 1
local BlurSize = 8
local TweenFo = TweenInfo.new (Speed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true, 1)

local Tween

--> Without the RemoteEvent
TweenService:Create ( Blur, TweenFo, {Size = BlurSize}):Play()

--[[
local RemoteEvent = game:GetService('ReplicatedStorage'):WaitForChild("RemoteEvent")
RemoteEvent.OnClientEvent:Connect(function(Toggle)
    if not Toggle then
        --> Stop
        if Tween then 
            Tween:Cancel()
        end
    else 
        --> Play
        Tween = TweenService:Create ( Blur, TweenFo, {Size = BlurSize})
        Tween:Play()
    end
end)
--]]
Ad

Answer this question