Why my R15 root join tilt script isn't working?

I would like to tilt my character like this: https://gfycat.com/amazingharmoniousbarb

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? :thinking:

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

If you’re using motor6d. Then you must use in local scripts (if im right since i rarely used motor6d)

For some reason, adding a wait() at the beginning of the script fixed the problem!

1 Like

which wait part you are placing in?

It’s the same script as before, but with a wait() at the beginning.

I discovered this solution from another topic (I sould’ve searched more before creating this topic lol): https://devforum.roblox.com/t/r15-character-not-tilting/181885

1 Like
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.

Nope, it’s a server script.
If it was a local script then it wouldn’t be visible for the other players.

The player’s character model replicates to the server but you mentioned it’s a server script so “game.Players.LocalPlayer” wouldn’t be valid anyhow.

Normally yes, but an admin on another topic said it won’t in this case.

Is the script being cloned into the character?

Yes, it is placed into StarterCharacterScripts.

Server scripts don’t execute when placed in the StarterCharacterScripts folder. They need to be parented elsewhere, like the workspace/ServerScriptService folders etc.