Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I rotate the player's character?

Asked by
aindev 4
6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
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)
Ad
Log in to vote
0
Answered by 6 years ago

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.

0
that just spins the character aindev 4 — 6y
0
that is what you said you are trying to do Sonostor 17 — 6y
0
no i needed it to rotate like upside down and sideways aindev 4 — 6y
0
hecking weeb used my exact code, just without getprimarypartcframe Gey4Jesus69 2705 — 6y
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 Sonostor 17 — 6y

Answer this question