hey if it were me id just shove it into chatgpt, if it cant fix it it can prob tell you whats wrong
i forgor to say that, anyways the thingy like flickers and stuff and its messy and stuff, i didint know how to explain it, and i still dont know how
- This script controls camera movements and visual effects based on raycasting.
- Tween parameters are set for adjusting volume, camera field of view, and color tint.
- Raycasting is performed to detect certain parts in the workspace.
- If the raycast hits a part named “TurnAroundPart”, specific effects are triggered.
- Camera movements are controlled using tween animations.
- Color correction and sound volume adjustments are handled based on the raycast result.
- The script connects to the RenderStepped event to update effects and raycasting continuously.
Good Luck
-- This script controls camera movements and visual effects based on raycasting.
local WorkspaceService = game.Workspace
local Sound = false
-- Tween parameters for adjusting volume
local VolumeTo = {
Volume = 1
}
local VolumeBack = {
Volume = 0
}
-- Tween animations for sound volume
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 to perform raycasting
function Raycast()
local deb = false
local camera = workspace.CurrentCamera
local cameraCF = camera.CFrame
local length = 1000
local params = RaycastParams.new()
-- Tween parameters for adjusting camera field of view
local NumberTweenTo = {
FieldOfView = 50
}
local NumberTweenBack = {
FieldOfView = 70
}
-- Tween parameters for adjusting color tint
local TintTo = {
TintColor = Color3.fromRGB(255, 128, 128)
}
local TintBack = {
TintColor = Color3.fromRGB(255, 255, 255)
}
-- Tween animations for color correction
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)
-- Tween animations for camera field of view
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)
-- Perform raycast
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
-- Connect to the RenderStepped event to update effects and raycast
game["Run Service"].RenderStepped:Connect(function()
if Sound == true then
SoundTweenBack:Cancel()
SoundTweenTo:Play()
Raycast()
else
SoundTweenTo:Cancel()
SoundTweenBack:Play()
Raycast()
end
end)
Are you saying you don’t know what you want it to do? And you can’t explain what you expect it to do?
Let me help you start. So finish this sentence:
I’m trying to make a script that will…
It’s making me uncomfortable how much space is between everything.
Same. I’ve never seen that much spacing. Also, why did they use a table for each of the values… I feel like you could just use variables. Just specify sound.Volume = VolumeBack
and VolumeBack = 0
…
I guess we should remember this dude is 11 though.
Also, PLEASE use task.wait(), I don’t care if it’s not intended, you need to.
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local camera = workspace.CurrentCamera
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)
local Sound = false
local function Raycast()
local deb = false
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 not raycastResult then return end
if raycastResult.Instance then
if raycastResult.Instance.Name == "TurnAroundPart" then
if not deb then
deb = true
MainTweenBack:Cancel()
MainTweenTo:Play()
task.wait(1.5)
Sound = true
SoundTweenTo:Play()
task.wait(0.2)
TintBackTween:Cancel()
TintToTween:Play()
task.wait(0.2)
game.Lighting.ColorCorrection.Enabled = false
game.Lighting.ColorCorrection2.Enabled = true
task.wait(0.2)
game.Lighting.ColorCorrection.Enabled = true
game.Lighting.ColorCorrection2.Enabled = false
task.wait(0.2)
game.Lighting.ColorCorrection.Enabled = false
game.Lighting.ColorCorrection2.Enabled = true
task.wait(0.2)
game.Lighting.ColorCorrection.Enabled = true
game.Lighting.ColorCorrection2.Enabled = false
task.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
RunService.RenderStepped:Connect(function()
if Sound then
SoundTweenBack:Cancel()
SoundTweenTo:Play()
Raycast()
else
SoundTweenTo:Cancel()
SoundTweenBack:Play()
Raycast()
end
end)
I organized it a bit.
I do not recommend to use ChatGPT for coding at all, given that it can screw up your script, or make code that doesn’t even work.
hey i hear people say this all the time, and whats really the difference? just wondering
ChatGPT is the worst programmer I’ve ever seen. I’d never rely on anything that thing has to say.
well chatgpt is very good for such task since all the correct data is given by the user
its just chatgpt fails at making scripts
-- Define constants and initial values
local WorkspaceService = game.Workspace
local Sound = false
local VolumeTo = { Volume = 1 }
local VolumeBack = { Volume = 0 }
-- Create tweens for sound volume
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 to perform raycasting
function Raycast()
local deb = false
local camera = workspace.CurrentCamera
local cameraCF = camera.CFrame
local length = 1000
local params = RaycastParams.new()
-- Define tweens for camera field of view and color correction
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 and raycastResult.Instance.Name == "TurnAroundPart" then
if not deb 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
for _ = 1, 2 do
wait(0.2)
game.Lighting.ColorCorrection.Enabled = not game.Lighting.ColorCorrection.Enabled
game.Lighting.ColorCorrection2.Enabled = not game.Lighting.ColorCorrection2.Enabled
end
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
-- Connect to RenderStepped event to update sound and raycast
game["Run Service"].RenderStepped:Connect(function()
if Sound then
SoundTweenBack:Cancel()
SoundTweenTo:Play()
Raycast()
else
SoundTweenTo:Cancel()
SoundTweenBack:Play()
Raycast()
end
end)
just to prove my point chatgpt managed to organize the script
FrostyTheDev This is not good formatting at all. Where did you ever pick this up. How can you possibly code like this. Notice every reply here is not so spaced out. Try to program more in blocks/chunks that can be summed up within a screen view. You can have a very long script but it’s made up of block/chunks like this. Look at GTX_3 script here… It’s made up of 5 chunks. Each one is easy to read and understand it’s role in the over all script.
Ok, I agree with that. As long as the prompt looks like this…
ChatGPT I want you to take away the spaces here and add some context to what it is doing. I do not want you to try to script anything. No guessing, no anything more than what I just told you. Just clean up this script without touching it with your logic in anyway other than what I have stated.
Chatgpt can easily do very simple tasks such as i asked it to do. Although you would normally give it more context. (wich i didnt) most errors caused by chatgpt can easily be fixed manually. (or you could just ask chatgpt to replace it If you explain the problem)
I think chatgpt or the roblox assistant are great tools for simple task and for searching to luau documentation.
keep in mind this was just an example and there should be given more context to the prompts given to chatgpt. My prompt was simply organize this luau code
Ya I don’t want to get off topic here. I stand by what I said. Last place I’d go to when learning how to code. I’ve never really paid into it however and just tried it out a few times. It never seems to pick the obvious answer so I don’t really trust it myself.
I didint use chat gpt… Tho uh idj
Then what is BRO DOING ON THE DEVFORUM
Oh,for this script.This script needs major inprovements