local Players = game:GetService("Players")
local TS = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local CurrentCamera = workspace.CurrentCamera
local CamFolder = workspace.CameraHandler
local CameraPart = CamFolder.CameraPart
local OriginalPos = CamFolder.OriginalPos
local y = OriginalPos.Size.Y / 2
local z = OriginalPos.Size.Z / 2
task.wait(1)
CurrentCamera.CameraType = Enum.CameraType.Scriptable
function MovePart(part, y, z)
local randomSpeed = math.random(1, 3)
print("In MovePart Function") -- This prints
local info = TweenInfo.new(randomSpeed, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local props = {Position = part.Position + Vector3.new(0, y, z)}
local tween = TS:Create(part, info, props)
print("Went through Tween variables") -- This prints
tween:Play()
tween.Completed:Wait()
print("Played Tween") -- This prints
end
function SetCam()
print("Heartbeat") -- This prints
CurrentCamera.CFrame = CameraPart.CFrame
end
RunService.Heartbeat:Connect(SetCam)
while true do
task.wait()
print("In Loop") -- This prints
local randomY = Vector3.new(0, math.random(-y, y), 0)
local randomX = Vector3.new(0, 0, math.random(-z, z))
MovePart(CameraPart, randomY, randomX)
end
All the prints print, and there are no errors, but tween doesn’t play through.
(and the camera does go to the CameraPart.CFrame, it’s just that the tween doesn’t play)
I have no idea what is wrong, so any help is appreciated!