I was just playing around with studio and tried this script with a button, but whenever I press it if the player's body isn't facing 0, 0, 0 it will just go crazy and the arms will break and legs. Heres the script:
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() local playerg = player.Character:GetChildren() for i,v in pairs(playerg) do if v.ClassName == "Part" then v.Orientation = Vector3.new(0, 0, 0) end end end)
Use :SetPrimaryPartCFrame
.
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() local playerg = player.Character or player.CharacterAdded:Wait() playerg:SetPrimaryPartCFrame(playerg:GetPrimaryPartCFrame() * CFrame.Angles(0, 0, 0)) end)
playerg:SetPrimaryPartCFrame(playerg:GetPrimaryPartCFrame() * CFrame.Angles(0, 0, 0))
will set the CFrame by first gettings the primary part's CFrame and then adding 0 degrees. When using CFrame.Angles()
make sure you use math.rad()
.