Struggling with putting the player in a ball

I’m trying to put the player in an unanchored ball and have that ball roll around with the natural game physics, that simple (no player-movement attached, no forces applied).

I found this thread that has two methods recommended

  1. “Clone the player model, position and weld the model to the ball if unanchored / position, anchor, and child the model to the ball if anchored. Set the player’s currentcamera.camerasubject to the ball.”
  2. “Take the player’s model, remove all animations, and weld it to the ball.”

I tried #2 first. Here is my script for that:

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Ball = script.Parent
local Model = script.Parent.Parent

local Player = nil

local function onPlayerTouchedBall(touched)
	local character = touched.Parent

	local player = Players:GetPlayerFromCharacter(character)
	if not player or Player then return end
	Player = player
	local humanoid = character:FindFirstChild("Humanoid")	

	local animator = humanoid:FindFirstChildOfClass("Animator")
	for i,v in ipairs(animator:GetPlayingAnimationTracks()) do
	--and to disable new animations from running:
	local animator = humanoid:FindFirstChildWhichIsA("Animator")

	humanoid.WalkSpeed = 0
	humanoid.AutoRotate = false

	local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
	humanoidRootPart.CFrame = Ball.CFrame

	local Weld ="WeldConstraint")
	Weld.Parent = workspace
	Weld.Part0 = humanoidRootPart
	Weld.Part1 = Ball
	Weld.Name = "BallWeld1"



This works… for about 3 seconds then the player “stands up” and the ball stops rolling. You can see that here:

I’ve scoured the dev hub for solutions, looked at lots of variations on the above including checking to make sure the humanoid state was not changing. It was… I don’t know why since this humanoid:ChangeState(Enum.HumanoidStateType.Physics) is
documented here saying that the state cannot change automatically once set to Physics. But it does - I confirmed with this

	humanoid.StateChanged:Connect(function(_oldState, newState)
		print("_ state changed"..tostring(_oldState).." new "..tostring(newState))

and saw it fire post-setting state to Physics

So, I disabled a bunch of states, like this

	humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Landed, false)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)

which “worked” in that the state change event no longer fired… but the ball behavior remained unchanged i.e. after 3 seconds the player is back to standing like normal.

Back to the original suggestions from the post linked above, I tried version 2 as well - same problem. I’m at a loss as to what to try next - any help would be much appreciated :slight_smile:

When the player is in the ball try using Humanoid.PlatformStand


wow, so simple. Thank you. I saw that go in my searching but was not intuitive what it was and I swear I saw somewhere it was deprecated but cannot find that now so I must have been looking at an older, related API or something.

Thanks much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.