Why this isn't Working?

  1. What do you want to achieve? Fix My script.

  2. What is the issue? The script is very simple but isn’t working.

  3. What solutions have you tried so far? I tried to look at DevHub but i din’t found an solution.

My script:

local kills50fov = game.ReplicatedStorage:WaitForChild("kills50fov")

kills50fov.OnClientEvent:Connect(function()
	local tween = game:GetService("TweenService")
	local twinfo = TweenInfo.new(22)
	local FieldOfView = game.Workspace.Camera.FieldOfView
	
	local tw = tween:Create(FieldOfView , twinfo, {
		FieldOfView = 90 --This isn't working
	})
	tw:Play()
end)

My script is giving the following error: Unable to cast value to Object

Why this is happening?

Cause you don’t create the tween on a property but rather on an object.
To make it work instead of doing :Create(FieldOfView, do :Create(workspace.Camera

1 Like