script.Parent.CFrame = CFrame.Angles(0, math.rad(45), 0)
COMMUNITY QUESTION
Whenever i execute this it moves the rotation and position, but i only wanna move rotation???
2 answers
The reason to why your script doesn't work is because CFrame.Angles creates a blank data type, ONLY containing its rotation. In order to solve your problem, you need to multiply the current CFrame with the Rotation.
Like such:
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0, math.rad(45), 0)
Simple turn
local x = 1
local y = 1
local z = 1
while true do -- Loop
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(x,y,z) -- Changes the orientation.
More advaned turn
--//Locals\\--
local SpinSpeedx = 0.2 -- Higher is less smooth
local SpinSpeedy = 0.2 -- Lower = smooth
local SpinSpeedz = 0.2 -- Medium speed = Looks laggy
local SpinWait = 0.01 -- How long it waits to show the next frame
--//Script\\--
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(SpinSpeedx,SpinSpeedy,SpinSpeedz)
wait(SpinWait)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
