When I'm using CFrame.Angles my upVector and lookVector doesnt change, if I even set them to the lowest number possible nothing changes, I tried using Orientation instead of CFrame.Angles but for some reason Orientation just doesn't work.
The thing I'm scripting is a tree that's supposed to tween out of the ground and when i'm using CFrame.Angles the tree doesn't fully come out of the baseplate. It get's stuck and if I try using Orientation the tree ends up getting flipped over even though its the same numbers on the math.rad and vector3.new
https://gyazo.com/4df52819b1ab8596af471b439328e7b3 -- gif showing what's happening with CFrame.Angles
(sorry if that was hard to understand im not really good at explaining stuff)
here's the code
local rp = game:GetService("ReplicatedStorage")
local treeEvent = rp:WaitForChild("treeEvent")
local tree = rp:WaitForChild("Tree"):Clone()
treeEvent.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local HRP = char:WaitForChild("HumanoidRootPart")
local ts = game:GetService("TweenService")
local treepos = {}
local Dmg = script.Dmg:Clone()
print("Event fired.") -- reminder that it works
tree.CFrame = HRP.CFrame + (-HRP.CFrame.upVector*195)
wait()
tree.Parent = workspace
script.Dmg.Player.Value = player.Name
Dmg.Parent = tree
Dmg.Disabled = false
local treeori = HRP.CFrame * CFrame.Angles(math.rad(-90),0,0)
treepos.CFrame = HRP.CFrame + (HRP.CFrame.upVector * 195)
treepos.CFrame = HRP.CFrame + (HRP.CFrame.lookVector * 50)
treepos.CFrame = treeori
local tweenInfo = TweenInfo.new(
2.7,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false,
0
)
local treeTween = ts:Create(tree, tweenInfo, treepos)
wait()
treeTween:Play()
wait(8)
tree:Remove()
end)
script with orientation instead of CFrame.Angles
https://gyazo.com/9d9963916a73b9a47047578fb0d9f0b1 -- gif showing what's happening with Orientation
local rp = game:GetService("ReplicatedStorage")
local treeEvent = rp:WaitForChild("treeEvent")
local tree = rp:WaitForChild("Tree"):Clone()
treeEvent.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local HRP = char:WaitForChild("HumanoidRootPart")
local ts = game:GetService("TweenService")
local treepos = {}
local Dmg = script.Dmg:Clone()
print("Event fired.") -- reminder that it works
tree.CFrame = HRP.CFrame + (-HRP.CFrame.upVector*195)
wait()
tree.Parent = workspace
script.Dmg.Player.Value = player.Name
Dmg.Parent = tree
Dmg.Disabled = false
local treeori = Vector3.new(-90,-90,0)
treepos.CFrame = HRP.CFrame + (HRP.CFrame.upVector * 195)
treepos.CFrame = HRP.CFrame + (HRP.CFrame.lookVector * 50)
treepos.Orientation = treeori
local tweenInfo = TweenInfo.new(
2.7,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false,
0
)
local treeTween = ts:Create(tree, tweenInfo, treepos)
wait()
treeTween:Play()
wait(8)
tree:Remove()
end)
