I’m trying to make an effect so that if you touch something an imagelabel and a blur will pop up, I have gotten all of that working but despite using a localscript, when someone touched the part everyone in the server regardless of where they are or having touched the part sees the effects
I am using this code in my localscript:
local DamagePart = workspace.KingOfficeVentSys:WaitForChild("DamagePart")
local TweenService = game:GetService("TweenService")
local VignetteTweenInfo = TweenInfo.new(10,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
local BlurTweenInfo = TweenInfo.new(10,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
local TextTweenInfo = TweenInfo.new(1.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local DeBlurrerInfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
local Vignette1 = game.Players.LocalPlayer.PlayerGui.VentEffect.ImageLabel1
local Vignette2 = game.Players.LocalPlayer.PlayerGui.VentEffect.ImageLabel2
local Vignette3 = game.Players.LocalPlayer.PlayerGui.VentEffect.ImageLabel3
local Text = game.Players.LocalPlayer.PlayerGui.VentEffect.TextLabel
local Blurrer = game.Lighting.Blur
local VignetteTween1 = TweenService:Create(Vignette1, VignetteTweenInfo, {ImageTransparency = 0})
local VignetteTween2 = TweenService:Create(Vignette2, VignetteTweenInfo, {ImageTransparency = 0})
local VignetteTween3 = TweenService:Create(Vignette3, VignetteTweenInfo, {ImageTransparency = 0})
local BlurTween = TweenService:Create(Blurrer, BlurTweenInfo, {Size = 56})
local DeBlurrer = TweenService:Create(Blurrer, DeBlurrerInfo, {Size = 0})
local TextTween = TweenService:Create(Text, TextTweenInfo, {TextTransparency = 0})
game.Workspace.KingOfficeVentSys.DamagePart.Touched:Connect(function(FXEnable)
if FXEnable and FXEnable.Parent and FXEnable.Parent:FindFirstChild("Humanoid") then
BlurTween:Play()
VignetteTween1:Play()
VignetteTween2:Play()
game.Workspace.GlobalSoundStorage.Misc.Heartbeat:Play()
wait(5)
VignetteTween3:Play()
game.Workspace.GlobalSoundStorage.Misc.EarRinging:Play()
wait(8)
TextTween:Play()
wait(2)
game.Workspace.GlobalSoundStorage.Misc.Heartbeat.Playing = false
DeBlurrer:Play()
end
end)
if FXEnable and FXEnable.Parent and FXEnable.Parent:FindFirstChild(“Humanoid”) and game.Players:GetPlayerFromCharacter(FXEnable.Parent) == game.Players.LocalPlayer then
game.Players.LocalPlayer.Character
You can set that as a variable in the localscript, assuming that your localscript is in a ScreenGui whose .ResetOnSpawn property is true
21:59:39.572 Players.thekingorespawn.PlayerScripts.VentEffectScript:21: Expected identifier when parsing expression, got Unicode character U+201c (did you mean '"'?) - Studio - VentEffectScript:21
i replaced the quotes with apostrophes and than the error went away, however the effects are now completely gone when i touch the part
Edit: How should I incorporate this line of code into the rest of the script?
local DamagePart = workspace.KingOfficeVentSys:WaitForChild("DamagePart")
local TweenService = game:GetService("TweenService")
local VignetteTweenInfo = TweenInfo.new(10,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
local BlurTweenInfo = TweenInfo.new(10,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
local TextTweenInfo = TweenInfo.new(1.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local DeBlurrerInfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
local Vignette1 = game.Players.LocalPlayer.PlayerGui.VentEffect.ImageLabel1
local Vignette2 = game.Players.LocalPlayer.PlayerGui.VentEffect.ImageLabel2
local Vignette3 = game.Players.LocalPlayer.PlayerGui.VentEffect.ImageLabel3
local Text = game.Players.LocalPlayer.PlayerGui.VentEffect.TextLabel
local Blurrer = game.Lighting.Blur
local VignetteTween1 = TweenService:Create(Vignette1, VignetteTweenInfo, {ImageTransparency = 0})
local VignetteTween2 = TweenService:Create(Vignette2, VignetteTweenInfo, {ImageTransparency = 0})
local VignetteTween3 = TweenService:Create(Vignette3, VignetteTweenInfo, {ImageTransparency = 0})
local BlurTween = TweenService:Create(Blurrer, BlurTweenInfo, {Size = 56})
local DeBlurrer = TweenService:Create(Blurrer, DeBlurrerInfo, {Size = 0})
local TextTween = TweenService:Create(Text, TextTweenInfo, {TextTransparency = 0})
game.Workspace.KingOfficeVentSys.DamagePart.Touched:Connect(function(FXEnable)
if FXEnable and FXEnable.Parent and FXEnable.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(FXEnable.Parent) == LocalPlayer then
BlurTween:Play()
VignetteTween1:Play()
VignetteTween2:Play()
game.Workspace.GlobalSoundStorage.Misc.Heartbeat:Play()
wait(5)
VignetteTween3:Play()
game.Workspace.GlobalSoundStorage.Misc.EarRinging:Play()
wait(8)
TextTween:Play()
wait(2)
game.Workspace.GlobalSoundStorage.Misc.Heartbeat.Playing = false
DeBlurrer:Play()
end
end)
I replaced the apostrophes with quotes again and it didnt give me an output error but it does still break the effects
if FXEnable and FXEnable.Parent and FXEnable.Parent:FindFirstChild(“Humanoid”) and game.Players:GetPlayerFromCharacter(FXEnable.Parent) == LocalPlayer then
You have a variable called “DamagePart” that’s be defined but never used. Bad practise to do such a thing, later in the code you need it but you’re referencing it straight from the workspace. Also, this is a local script using Touched? I don’t recommend using Touched on the client for many reasons, despite the fact that the Touched Script Signal relies on the client position rather than the server position for “less delay”. I’d recommend doing checks to see if their position is valid, on the server. And handle Touched events on the server. To make this work for only one player, you’d have to use Local Player. so game.Players.LocalPlayer