I need someone to fix this script, You can do anything, orginise it or something… I just want it to work like it shoud!
local WorkspaceService = game.Workspace
local Sound = false
local VolumeTo = {
Volume = 1
}
local VolumeBack = {
Volume = 0
}
local SoundTweenTo = game.TweenService:Create(script.HB, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), VolumeTo)
local SoundTweenBack = game.TweenService:Create(script.HB, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), VolumeBack)
function Raycast()
local deb = false
local camera = workspace.CurrentCamera
local cameraCF = camera.CFrame
local length = 1000
local params = RaycastParams.new()
local NumberTweenTo = {
FieldOfView = 50
}
local NumberTweenBack = {
FieldOfView = 70
}
local TintTo = {
TintColor = Color3.fromRGB(255, 128, 128)
}
local TintBack = {
TintColor = Color3.fromRGB(255, 255, 255)
}
local TintToTween = game.TweenService:Create(game.Lighting.ColorCorrection, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), TintTo)
local TintBackTween = game.TweenService:Create(game.Lighting.ColorCorrection, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), TintBack)
local MainTweenTo = game.TweenService:Create(game.Workspace.CurrentCamera, TweenInfo.new(4, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), NumberTweenTo)
local MainTweenBack = game.TweenService:Create(game.Workspace.CurrentCamera, TweenInfo.new(2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), NumberTweenBack)
local raycastResult = workspace:Raycast(cameraCF.Position, cameraCF.LookVector * length, params)
if raycastResult then
if raycastResult.Instance then
if raycastResult.Instance.Name == "TurnAroundPart" then
if deb == false then
deb = true
MainTweenBack:Cancel()
MainTweenTo:Play()
wait(1.5)
Sound = true
SoundTweenTo:Play()
wait(0.2)
TintBackTween:Cancel()
TintToTween:Play()
wait(0.2)
game.Lighting.ColorCorrection.Enabled = false
game.Lighting.ColorCorrection2.Enabled = true
wait(0.2)
game.Lighting.ColorCorrection.Enabled = true
game.Lighting.ColorCorrection2.Enabled = false
wait(0.2)
game.Lighting.ColorCorrection.Enabled = false
game.Lighting.ColorCorrection2.Enabled = true
wait(0.2)
game.Lighting.ColorCorrection.Enabled = true
game.Lighting.ColorCorrection2.Enabled = false
wait(0.2)
game.TweenService:Create(game.Lighting.ColorCorrection, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0), {TintColor = Color3.fromRGB(49, 0, 0)
}):Play()
else
Sound = false
deb = false
MainTweenTo:Cancel()
MainTweenBack:Play()
TintToTween:Cancel()
TintBackTween:Play()
end
else
deb = false
Sound = false
MainTweenTo:Cancel()
MainTweenBack:Play()
TintToTween:Cancel()
TintBackTween:Play()
end
else
deb = false
Sound = false
MainTweenTo:Cancel()
MainTweenBack:Play()
TintToTween:Cancel()
TintBackTween:Play()
end
end
end
game["Run Service"].RenderStepped:Connect(function()
if Sound == true then
SoundTweenBack:Cancel()
SoundTweenTo:Play()
Raycast()
else
SoundTweenTo:Cancel()
SoundTweenBack:Play()
Raycast()
end
end)