Hello, my name is Fizzavocadoo and I am a builder and I am a new member of dev forum. So last week I have decided to make a story and horror game with a condition that players can only see the ghost when a camera tool is equip.
Yesterday I have try to script the camera with my little knowledge of scripting and I got not bad result ( You can go see the video below). but there’s some issues.
Firstly, The FOV when I equip the camera is not working and that’s the issue so far but I need some of your suggestion on how I can make it smoother and more recording like effects. I want to achieve something like a security camera opening animation from the game Fnaf. This is just the prototype and I will add more animation and effects soon if I can. so please try to give me some feedback and some suggestion.
I wrote the script by myself with the help of my little knowledge of scripting and Youtube tutorials. I also try to find some tutorials to fix my FOV problem but still can’t get it working here is the script.
Tool = script.Parent
local function GhostAppear()
local GhostH = game.Workspace.Ghost.Head
local GhostRA = game.Workspace.Ghost["Right Arm"]
local GhostLA = game.Workspace.Ghost["Left Arm"]
local GhostRL = game.Workspace.Ghost["Right Leg"]
local GhostLL = game.Workspace.Ghost["Left Leg"]
local GhostT = game.Workspace.Ghost.Torso
GhostH.Transparency = 0
GhostRA.Transparency = 0
GhostLA.Transparency = 0
GhostRL.Transparency = 0
GhostLL.Transparency = 0
GhostT.Transparency = 0
end
local function GhostDisappear()
local GhostH = game.Workspace.Ghost.Head
local GhostRA = game.Workspace.Ghost["Right Arm"]
local GhostLA = game.Workspace.Ghost["Left Arm"]
local GhostRL = game.Workspace.Ghost["Right Leg"]
local GhostLL = game.Workspace.Ghost["Left Leg"]
local GhostT = game.Workspace.Ghost.Torso
GhostH.Transparency = 1
GhostRA.Transparency = 1
GhostLA.Transparency = 1
GhostRL.Transparency = 1
GhostLL.Transparency = 1
GhostT.Transparency = 1
end
local function ColorCorrection1()
game.Lighting.ColorCorrection.Enabled = true
end
local function ColorCorrection2()
game.Lighting.ColorCorrection.Enabled = false
end
function OnEquip()
local FOV = 50
local character = Tool.Parent
local Player = game.Players:GetPlayerFromCharacter(character)
Gui = script.Parent.Gui:Clone()
Gui.Parent = Player.PlayerGui
GhostAppear()
ColorCorrection1()
game.Workspace.Camera.FieldOfView = FOV
wait(0.1)
script.Parent.Handle.Transparency = 1
end
function OnUnequip()
local FOV = 50
Gui:Destroy()
GhostDisappear()
ColorCorrection2()
game.Workspace.Camera.FieldOfView = FOV
wait(0.1)
script.Parent.Handle.Transparency = 0
end
Tool.Equipped:Connect(OnEquip)
Tool.Unequipped:Connect(OnUnequip)
I’m sorry if the script I wrote is a bit trash but it works.