I was trying to make a tilt camera when player moves right or left and i just searched some resources.
I checked this thread: How to tilt camera smoothly based on the players movement
Then i decide to change some settings to make more smoother. But it did’nt work and i opened the thread here: Having a Tween problem
After that, some helpful people tried to help me but i could’nt get the solution. As i mentioned in the thread, if it still does’nt work again (actually still it was’nt working) i could open thread in roblox studio bugs. But later i realized it was related to my script but i dont know how to do it and thats why im opening this thread.
If we come to my problem, i want to tilt the camera, when player goes left or right smoother. But it goes immediately, Here is the script:
-- this script in the startercharacterscript
local Player = game.Players.LocalPlayer
local Humanoid = Player.Character:WaitForChild("Humanoid")
local Camera = game.Workspace.CurrentCamera
local Debounce = false
local RunService = game:GetService("RunService")
local userInput = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(2,Enum.EasingStyle.Linear)
local function doTween(degrees)
local TweenCreate = TweenService:Create(Camera,info,{CFrame = Camera.CFrame * CFrame.Angles(0,0,math.rad(degrees))})
TweenCreate:Play()
end
RunService.RenderStepped:Connect(function()
if userInput:IsKeyDown(Enum.KeyCode.A) and userInput:IsKeyDown(Enum.KeyCode.D) then
doTween(0)
elseif userInput:IsKeyDown(Enum.KeyCode.A) then
doTween(20)
elseif userInput:IsKeyDown(Enum.KeyCode.D) then
doTween(-20)
else
doTween(0)
end
end)
If you try it, you will understand what is happening. And sorry if i reply so late. Thanks already.