Yes I renamed the part to Zume after your second edit, and changed it in the script, and then after your last edit I changed the name to ZoomPart and changed the name in the script, neither yielded any results.
You didn’t really change the part variable to “ZoomPart” string, did you? You’re supposed to reference the object that is inside the Workspace.
I clicked rename on the part inside explorer and Typed in Zume in the explorer
Could I see how your Part variable is formed? It should look like this…
local Part = whatever your thing is
I’m talking about inside of the script, an image of the instance is irrelevant. It should look like this…
local Part = whatever your thing is
You forgot to add the RemoteEvent. There’s nothing inside ReplicatedStorage… Click on ReplicatedStorage and click on the plus button, then type RemoveEvent and rename the thing that appears in ReplicatedStorage to “FOVChanger”.
Nah, the remote event was added when I actually tried it. That screenshot that I showed you above was me going back inside the game and showing you how I had it setup. I just re-pasted the script to show you.
local Part = game.Workspace.ZoomPart -- change to wanted part
local LocalPlayer = game.Players.LocalPlayer
local robloxFovLimit = {
min = 1;
max = 120;
default = 70;
}
local RunService = game:GetService([[RunService]])
local function pause(n)
local t = os.time()
repeat RunService.RenderStepped:Wait() until os.time() - t >= n
end
local camera = game.Workspace.CurrentCamera
local fovIsChanging = false
local function smoothFov(startFov, goal, fovPerInterval, interval)
if startFov == nil then startFov = camera.FieldOfView end
if startFov < robloxFovLimit.min or startFov > robloxFovLimit.max or goal < robloxFovLimit.min or goal > robloxFovLimit.max or startFov - goal == 0 or fovIsChanging == true then return end
fovIsChanging = true
for i = startFov, goal, goal > startFov and fovPerInterval or -fovPerInterval do
camera.FieldOfView = i
pause(interval)
end
fovIsChanging = false
end
Part.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChildOfClass([[Humanoid]])
local Player = Humanoid and game.Players:GetPlayerFromCharacter(Humanoid.Parent)
if Player then
if Player == LocalPlayer then
local startingFOV = nil -- change to nil which sets to current fov or new starting fov (from 1 to 120)
local goalFOV = 20 -- change the rest of the variables to wanted value
local fovPerTick = 1 -- fov changes by this number every time a cetain amount of time passes
local fovChangeCooldown = 0.05 -- cooldown until fov ticks/changes
smoothFov(startingFOV, goalFOV, fovPerTick, fovChangeCooldown)
end
end
end)
-- Usage example: smoothFov(camera.FieldOfView, 20, 0.3, 0.01)
Maybe you have an outdated version of the 2 scripts that I provided, so just delete the 2 I provided and replace with the above script. Remember to reference your part in the Part variable.
Oh, and, it’s a LocalScript. Place it in StarterPlayerScripts or StarterCharacterScripts.
Ok so I put that in a local script inside starterplayerscripts, and renamed the part to ZoomPart. What now? Gonna do this all step by step.
Quick question, are you lowering the FOV or making it higher or just using the preset? This could have been a mistake from the beginning that hasn’t been fixed through the script, so I need to know.
How about this. Join me in this game I’ll show you real quick.
I have an extension so i’ll be able to join your username
local Part = game.Workspace.ZoomPart -- change to wanted part
local LocalPlayer = game.Players.LocalPlayer
local robloxFovLimit = {
min = 1;
max = 120;
default = 70;
}
local RunService = game:GetService([[RunService]])
local function pause(n)
local t = os.time()
repeat RunService.RenderStepped:Wait() until os.time() - t >= n
end
local camera = game.Workspace.CurrentCamera
local fovIsChanging = false
local function smoothFov(startFov, goal, fovPerInterval, interval)
if startFov == nil then startFov = camera.FieldOfView end
if startFov < robloxFovLimit.min or startFov > robloxFovLimit.max or goal < robloxFovLimit.min or goal > robloxFovLimit.max or startFov - goal == 0 or fovIsChanging == true then return end
fovIsChanging = true
for i = startFov, goal, goal > startFov and fovPerInterval or -fovPerInterval do
camera.FieldOfView = i
pause(interval)
end
fovIsChanging = false
end
Part.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChildOfClass([[Humanoid]])
local Player = Humanoid and game.Players:GetPlayerFromCharacter(Humanoid.Parent)
if Player then
if Player == LocalPlayer then
local startingFOV = nil -- change to nil which sets to current fov or new starting fov (from 1 to 120)
local goalFOV = 20 -- change the rest of the variables to wanted value
local fovPerTick = 1 -- fov changes by this number every time a cetain amount of time passes
local fovChangeCooldown = 0.05 -- cooldown until fov ticks/changes
smoothFov(startingFOV, goalFOV, fovPerTick, fovChangeCooldown)
end
end
end)
-- Usage example: smoothFov(camera.FieldOfView, 20, 0.3, 0.01)
Just ignore everything I said, replace the LocalScript with this script, reference your part in the Part variable, and run the code.
Alright, I am going to join that game though.
Let me know once in, im waiting to join
Replaced the script and referenced the part. Whats next.
The message said to run the code…