So I’m trying to make something similar to fnaf
But when I switch from one side to another too quick, It breaks. https://i.gyazo.com/173a8e0425612fcd7be3d14344abe219.mp4
local replicatedstorage = game:GetService("ReplicatedStorage")
local tweenservice = game:GetService("TweenService")
local leftevent = replicatedstorage:WaitForChild("Left")
local leftfrontevent = replicatedstorage:WaitForChild("LeftToFront")
local rightevent = replicatedstorage:WaitForChild("Right")
local rightfrontevent = replicatedstorage:WaitForChild("RightToFront")
leftevent.OnServerEvent:Connect(function()
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
local tween = tweenservice:Create(workspace:WaitForChild("CamPart"),tweeninfo,{Orientation = workspace:WaitForChild("CamPart").Orientation + Vector3.new(0,50,0)})
tween:Play()
end)
leftfrontevent.OnServerEvent:Connect(function()
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
local tween = tweenservice:Create(workspace:WaitForChild("CamPart"),tweeninfo,{Orientation = Vector3.new(0,-180,0)})
tween:Play()
end)
--RIGHT
rightevent.OnServerEvent:Connect(function()
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
local tween = tweenservice:Create(workspace:WaitForChild("CamPart"),tweeninfo,{Orientation = workspace:WaitForChild("CamPart").Orientation + Vector3.new(0,-50,0)})
tween:Play()
end)
rightfrontevent.OnServerEvent:Connect(function()
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
local tween = tweenservice:Create(workspace:WaitForChild("CamPart"),tweeninfo,{Orientation = Vector3.new(0,180,0)})
tween:Play()
end)