Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I rotate the player's character?

When I tried to rotate the players character, it just kills the player.

script.Parent.Touched:Connect(function(hit)
for i,v in pairs(hit:GetChildren()) do
if v:IsA("Humanoid") or v:IsA("CharacterMesh") or v:IsA("Accessory") then
else
v.Orientation = Vector3.new(0, -90, 0)
end
end)

2 answers

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
	hit.Parent:SetPrimaryPartCFrame(hit.Parent:GetPrimaryPartCFrame()*CFrame.Angles(0,math.rad(10),0))
	end
end)

The outcome you are getting (player dies) is because you are rotating all the parts individually which breaks their joints. You would need to rotate them all relative to one part.

script.Parent.Touched:connect(function(hit)
local h = hit.Parent:FindFirstChild('Humanoid')
if h then
h.Parent:SetPrimaryPartCFrame(h.Parent.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(-90),0))
end
end)

This should work. If it does not, research the SetPrimaryPartCFrame() function. Do not rely on SetPrimaryPartCFrame() in the future as it slowly will distort the model you are positioning.

5 comments

0

that just spins the character

0

that is what you said you are trying to do

0

no i needed it to rotate like upside down and sideways

0

hecking weeb used my exact code, just without getprimarypartcframe

0

when i typed my answer, yours wasn't even there, and yours gives no help at all showing what he did wrong. overall my post did a better job, please don't bring toxicity here

This discussion is preserved as it was. New answers, comments, and votes are closed.