script.Parent.recoil.OnClientEvent:Connect(function()
local asset = game.Workspace.CurrentCamera.CFrame
game.TweenService:Create(asset,TweenInfo.new(0.1,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Rotation = asset.Rotation + Vector3.new(0,5,0)}):Play()
end)
This script is not working for recoil, does anyone know why? I’m trying to make this recoil system work. It has no affect on the camera.
Unable to cast value to Object - Client
The only error.
1 Like
No don’t put the camera’s CFrame, just do this
local asset = game.Workspace.CurrentCamera
It takes the object not the CFrame it’s at, it just tweens wherever it’s at to the position you want it to go to
1 Like
game.TweenService:Create(asset,TweenInfo.new(0.1,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Rotation = asset.Rotation + Vector3.new(0,5,0)}):Play()
is game.Workspace.CurrentCamera.Rotation
a thing, though?
(changing asset didn’t do a thing)
1 Like
nothing has a property called “Rotation”
this should work
local asset = game.Workspace.CurrentCamera
game.TweenService:Create(asset,TweenInfo.new(0.1,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{CFrame = asset.CFrame * CFrame.Angles(0,math.rad(5),0)}):Play()
CFrame is better for rotation since CFrame contains position and rotation
1 Like
It still locks the camera position in place for the 0.1 duration. How could I make it just affect Rotation?
1 Like
Is it moving at all or are you saying that it’s not rotating?
1 Like
The Camera gets locked in position while the character goes on moving for 0.1s, the rotation works, I just want to know how to get it to only change Rotation, not position.
Is the camera changed to scriptable if so remove that
1 Like
The camera is set to fixed, not scriptable, I just need to know how to only influence rotation with tween
It is only affecting rotation because you take the camera’s CFrame and add the rotation (CFrame.Angles), the camera can’t be fixed that make the camera stay in position, if it’s Custom it still follows the character
1 Like