My script is works perfectly with R6 characters, but not with R15 characters.
I don’t understand why, I’m pretty sure LowerTorso.Root is the R15 equivalent for HumanoidRootPart.RootJoint… What could be wrong with my script?
local char = script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
local tilt = CFrame.Angles(math.rad(-90), 0, 0)
if humanoid.RigType == Enum.HumanoidRigType.R15 then
local root = char:WaitForChild("LowerTorso"):WaitForChild("Root")
root.C1 = root.C1 * tilt
else
local rootJoint = hrp:WaitForChild("RootJoint")
rootJoint.C1 = rootJoint.C1 * tilt
end
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
local tilt = CFrame.Angles(math.rad(-90), 0, 0)
if humanoid.RigType == Enum.HumanoidRigType.R15 then
local root = char:WaitForChild("LowerTorso"):WaitForChild("Root")
root.C1 = root.C1 * tilt
else
local rootJoint = hrp:WaitForChild("RootJoint")
rootJoint.C1 = rootJoint.C1 * tilt
end
Is this a local script? If so define player using “game.Players.LocalPlayer” and get the character from that. I’m assuming this is a local script inside the StarterCharacterScripts folder.
Server scripts don’t execute when placed in the StarterCharacterScripts folder. They need to be parented elsewhere, like the workspace/ServerScriptService folders etc.