CFrame.Angles dont set correctly

I randomly stumble across on glitch that it dont set to a correct 180 , and instead it set to a incorrect angle

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

workspace.StartWall.Touched:Connect(function()
	workspace.StartWall.CanTouch = false
	for i,v in pairs(Players:GetPlayers()) do
		local Character = v.Character
		Character:PivotTo(workspace.TP.CFrame)
	end
	
	ReplicatedStorage.Cutscene:FireAllClients()
	wait(3)
	
	workspace.Door.Open:Play()
	TweenService:Create(workspace.Door.Door1,TweenInfo.new(0.8),{Size = Vector3.new(0.5,1,21),Position = Vector3.new(39.75, 0.7, -282.286)}):Play()
	TweenService:Create(workspace.Door.Door2,TweenInfo.new(0.8),{Size = Vector3.new(0.5,1,21),Position = Vector3.new(60.25, 0.7, -282.286)}):Play()
	wait(0.8)
	workspace.Door.Door1:Destroy()
	workspace.Door.Door2:Destroy()
	wait(1)
	local function TweenModel()
		local CFrameValue = Instance.new("CFrameValue")
		CFrameValue.Value = CFrame.new(50, -7, -282.286) * CFrame.Angles(0,180,0)
		
		CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
			workspace.Boss:PivotTo(CFrameValue.Value)
		end)
		
		TweenService:Create(CFrameValue,TweenInfo.new(1),{Value = CFrame.new(50, 10, -282.286) * CFrame.Angles(0,180,0)}):Play()
		
		wait(1)
		CFrameValue:Destroy()
	end
	
	TweenModel()
	
	wait(2)
	TweenService:Create(workspace.Boss.Liquid,TweenInfo.new(1),{Size = Vector3.new(20,20,20),Transparency = 1}):Play()
	workspace.Boss.Liquid.Explode:Play()
	local AnimTrack = workspace.Boss.Humanoid:LoadAnimation(workspace.Boss.Idle)
	AnimTrack:Play()
	
	workspace.Boss.Sword.PointLight.Enabled = true
end)
1 Like

For some reasons, CFrame angles are constructed using radians as the unit instead of degrees.

Replacing 180 with math.pi is a quick way to fix it without using math.rad().

I used math.pi, but it glitched for some reason, but then i used math.rad and it worked, i never use math.rad though.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.