I'm trying to make a game where you are only a single sphere rather than a person, but I don't know how to do that. I've tried looking online for help, but I could only found out how to make controllable custom humanoids and not controllable objects. I also need help on where I put the scripts that make me control a sphere.
A simple fix would be to use StarterCharacter and it will work perfectly!
EDIT : New Script/Method
This is just my method and I'm sure there are many others that can be thought up
Example Rotation Script( Rotates Character Forwards )
Following Script Uses CFrame not BodyGyro/Velocity
local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService") local Player = game.Players.LocalPlayer repeat wait() until Player.Character repeat wait() until Player.Character.Humanoid repeat wait() until Player.Character.HumanoidRootPart local Character = Player.Character local HumanoidRootPart = Character.HumanoidRootPart local Humanoid = Character.Humanoid Humanoid.AutoRotate = false local W = false local A = false local S = false local D = false local Space = false local Camera = workspace.CurrentCamera local Mouse = Player:GetMouse() local RotateSpeed = 3 RunService.RenderStepped:Connect(function() if(W == true) or (A == true) or (S == true) or (D == true) then local LookVector = Camera.CFrame.LookVector*RotateSpeed if W then Character.LowerTorso.Root.C1 = Character.LowerTorso.Root.C1 * CFrame.Angles(-math.rad(LookVector.Z),math.rad(LookVector.Y)*0,math.rad(LookVector.X)) end end end) UIS.InputBegan:Connect(function(Input, Bool) if(Bool == false) then if(Input.KeyCode == Enum.KeyCode.W) then W = true end end end) UIS.InputEnded:Connect(function(Input, Bool) if(Bool == false) then if(Input.KeyCode == Enum.KeyCode.W) then W = false end end end)
Normally for performance reasons, as well as not having to deal with things like humanoid states for something that doesn't really have them, you want to uncheck the CharacterAutoLoads property of Players and just write a simple controller that maps user input to a force or velocity vector, for setting force or velocity on the ball (which could have a BodyVelocity or BodyForce object).
Most of the time, it's intuitive for a user's "foward" input (e.g. W key pressed) to contribute a force in the direction of game.Workspace.CurrentCamera.LookVector
, or it's projection onto the ground plane, game.Workspace.CurrentCamera.LookVector * Vector3.new(1,0,1)
. Likewise, right and left controls map to forces (or velocity) in the direction of the camera RightVector, or opposite this, respectively.