How do I make a player marble

Okay, so inside of a localscript in playergui, youll need to set the character’s humanoid platformstanding to true:
game.Players.LocalPlayer.Character.Humanoid.PlatformStanding = true
Then, youll need to change the velocity of the ball by wherever the character is moving:

while wait() do
     ball.Velocity = ball.Velocity + character.Humanoid.MoveDirection
end
1 Like

Ok so I tried to get the script to work but this happens:


the red lines of death are back.

1 Like

You need to declare those variables, marble should be your marble object wherever you created it in workspace, and your character should be your character

2 Likes

first declare the variables, for example :

local marble = workspace.marble
   
 local character = game:GetService("Players").LocalPlayer.Character

after declaring those, you can use them anywhere you want in your script, i.e the one you declared them in. To share variables _G is used, which isn’t recommended in certain cases but you can use module scripts to share functions and variables too etc.

1 Like

You can use this script in the sphere, so when a player touches it and h is found, welds are created and the body angular velocity is then changed
Code for script in part :

function onTouched(hit)
	if hit.Parent:FindFirstChild("Humanoid") == nil  then return end
	if hit.Parent.Humanoid == nil then return end
	script.Disabled = true
	
	local sp = script.Parent
	
	local a = Instance.new("Weld") 
	a.Parent=sp
	local b = Instance.new("Weld")
	b.Parent=sp
	local c = Instance.new("Weld")
	c.Parent=sp
	local d = Instance.new("Weld")
	d.Parent=sp
	local e = Instance.new("Weld")
	e.Parent=sp
	local f = Instance.new("Weld")
	f.Parent=sp

	a.Part0 = hit.Parent:FindFirstChild("RightArm")
	b.Part0 = hit.Parent:FindFirstChild("Torso")
	c.Part0 = hit.Parent:FindFirstChild("Left Arm")
	d.Part0 = hit.Parent:FindFirstChild("Left Leg")
	e.Part0 = hit.Parent:FindFirstChild("Right Leg")	
	f.Part0 = hit.Parent:FindFirstChild("HumanoidRootPart")
	
	a.Part1 = script.Parent
	b.Part1 = script.Parent
	c.Part1 = script.Parent
	d.Part1 = script.Parent
	e.Part1 = script.Parent
	f.Part1 = script.Parent
	
	

	wait(2)
	hit.Parent.Humanoid.Sit = true
	
	
	if hit.Parent.Humanoid.RigType == Enum.HumanoidRigType.R6 then
		hit.Parent.Humanoid.CameraOffset = Vector3.new(hit.Parent.Humanoid.CameraOffset.x,hit.Parent.Humanoid.CameraOffset.y - 1.5,hit.Parent.Humanoid.CameraOffset.z)
	elseif hit.Parent.Humanoid.RigType == Enum.HumanoidRigType.R15 then
		hit.Parent.Humanoid.CameraOffset = Vector3.new(hit.Parent.Humanoid.CameraOffset.x,hit.Parent.Humanoid.CameraOffset.y - 2,hit.Parent.Humanoid.CameraOffset.z)
	end
	while true do
		if hit.Parent == nil then break end
		if hit.Parent.Humanoid.Sit == false then break end
		wait()
		script.Parent.BodyAngularVelocity.AngularVelocity = Vector3.new(hit.Parent.Humanoid.MoveDirection.z * 32,0,hit.Parent.Humanoid.MoveDirection.x * -32)
		script.Parent.BodyAngularVelocity.MaxTorque = Vector3.new(4000,4000,4000)
		if hit.Parent.Humanoid.MoveDirection == Vector3.new(0,0,0) then
			script.Parent.BodyAngularVelocity.MaxTorque = Vector3.new(0,0,0)
		end
	end
	script.Parent.BodyAngularVelocity.MaxTorque = Vector3.new(0,0,0)
	if hit.Parent.Humanoid.RigType == Enum.HumanoidRigType.R6 then
		hit.Parent.Humanoid.CameraOffset = Vector3.new(hit.Parent.Humanoid.CameraOffset.x,hit.Parent.Humanoid.CameraOffset.y + 1.5,hit.Parent.Humanoid.CameraOffset.z)
	elseif hit.Parent.Humanoid.RigType == Enum.HumanoidRigType.R15 then
		hit.Parent.Humanoid.CameraOffset = Vector3.new(hit.Parent.Humanoid.CameraOffset.x,hit.Parent.Humanoid.CameraOffset.y + 2,hit.Parent.Humanoid.CameraOffset.z)
	end

	script.Parent:BreakJoints()
	wait(1.5)
	script.Disabled = false
end
script.Parent.Touched:connect(onTouched)

There should be a bodyangularvelocity in the part too.

2 Likes

You can take a look at this place:

Make a few adjustments regarding how I CFrame, replicate, and animate the character to instead a weld and boom you have what you’re looking for!

You get the jist…

23 Likes

@EgoMoose, have you use your character controller ?

1 Like

Haha, funny, “Super Primate Ball”. What a kick back to childhood if you replace the middle word.

I wonder, by any chance, is it possible to switch in and out of a ball form or is this intended for games that, at all times, should be played in marble form? The code in this place appears to have the actual marble system integrated as the main character system.

Salvaging it is possible but I’m wondering about native support.

5 Likes
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer --i use the LocalPlayer Method, his is a Local Script

UserInputService.InputBegan:Connect(functon(input, gameProcessedEvent)
   local Camera = workspace.CurrentCamera
   local FakeUpVector = Vector3.new(0,1,0)
   local RightVector = Camera.CFrame.LookVector:Cross(FakeUpVector)
   local LeftVector = -RightVector
   local ForwardVector = Camera.CFrame.LookVector
   local BackVelocity = -ForwardVector

   if input.UserInputType == Enum.UserInputType.Keyboard then
      local key = input.KeyCode
      if key == Enum.KeyCode.W then
            local ForwardVelocity = Instance.new("BodyVelocity", Marble)
            ForwardVelocity.Name = "ForwardVelocity"
            ForwardVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
            ForwardVelocity.Velocity = ForwardVector*250
            ForwardVelocity.P = 1000
      elseif key == Enum.KeyCode.A then
            local LeftVelocity = Instance.new("BoddyVelocity", Marble)
            LeftVelocity.Name = "LeftVelocity"
            LeftVelocity.P = 10000 
            LeftVelocity.Velocity = LeftVector*250
      elseif key.Enum.KeyCode.D then
            local RightVelocity = Instance.new("BoddyVelocity", Marble)
            RightVelocity,Name = "RightVelocity"
            RightVelocity.P = 10000
            RightVelocity.Velocity = RightVector*250
      elseif key == Enum.KeyCode.S then
               local BackVelocity = Instance.new("BoddyVelocity", Marble)
               BackVelocity.Name = "BackVelocity"
               BackVelocity.P = 10000
               BackVelocity.Velocity = BackVelocity*250
            end
       end
 end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
   if input.UserInputType == Enum.UserInputType.KeyBoard then
      local key = input.KeyCode
      if key == Enum.KeyCode.W then
         if Marble:FindFirstChild("ForwardVelocity") then
            Marble.ForwardVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.A then
         if Marble:FindFirstChild("LeftVelocity") then
            Marble.LeftVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.D then
         if Marble:FindFirstChild("RightVelocity") then
            Marble.RightVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.S then
         if Marble:FindFirstChild("BackVelocity") then
            Marble.BackVelocity:Destroy()
         end
      end
   end
end)

@funkmeist123, i cant try this script, but it should work. If you see a misstake, say it me pls.

1 Like

Final Code look like this(LOCAL SCRIPT):

local function WeldTwoParts(A, B)
   local weld = Instance.new("WeldConstraint")
   weld.Parent = workspace
   weld.Part0 = A
   weld.Part1 = B
end

local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
if not Character or not Character.Parent then
   Character = Player.CharacterAdded:wait()
end
local HRP = Character.HumanoidRootPart
local Marble = workspace.Marble

wait(5)
character:SetPrimaryPartCFrame(Marble.CFrame)
WeldTwoParts(HRP, Marble)    

UserInputService.InputBegan:Connect(functon(input, gameProcessedEvent)
   local Camera = workspace.CurrentCamera
   local FakeUpVector = Vector3.new(0,1,0)
   local RightVector = Camera.CFrame.LookVector:Cross(FakeUpVector)
   local LeftVector = -RightVector
   local ForwardVector = Camera.CFrame.LookVector
   local BackVelocity = -ForwardVector

   if input.UserInputType == Enum.UserInputType.Keyboard then
      local key = input.KeyCode
      if key == Enum.KeyCode.W then
            local ForwardVelocity = Instance.new("BodyVelocity", Marble)
            ForwardVelocity.Name = "ForwardVelocity"
            ForwardVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
            ForwardVelocity.Velocity = ForwardVector*250
            ForwardVelocity.P = 1000
      elseif key == Enum.KeyCode.A then
            local LeftVelocity = Instance.new("BoddyVelocity", Marble)
            LeftVelocity.Name = "LeftVelocity"
            LeftVelocity.P = 10000 
            LeftVelocity.Velocity = LeftVector*250
      elseif key.Enum.KeyCode.D then
            local RightVelocity = Instance.new("BoddyVelocity", Marble)
            RightVelocity,Name = "RightVelocity"
            RightVelocity.P = 10000
            RightVelocity.Velocity = RightVector*250
      elseif key == Enum.KeyCode.S then
               local BackVelocity = Instance.new("BoddyVelocity", Marble)
               BackVelocity.Name = "BackVelocity"
               BackVelocity.P = 10000
               BackVelocity.Velocity = BackVelocity*250
            end
       end
 end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
   if input.UserInputType == Enum.UserInputType.KeyBoard then
      local key = input.KeyCode
      if key == Enum.KeyCode.W then
         if Marble:FindFirstChild("ForwardVelocity") then
            Marble.ForwardVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.A then
         if Marble:FindFirstChild("LeftVelocity") then
            Marble.LeftVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.D then
         if Marble:FindFirstChild("RightVelocity") then
            Marble.RightVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.S then
         if Marble:FindFirstChild("BackVelocity") then
            Marble.BackVelocity:Destroy()
         end
      end
   end
end)
2 Likes

I found this red line on line 22

1 Like

Hey excuse me for asking but I’ve edited the scripts slightly to get it more in line with what I want but all I need to do is remove the wall climbing gravity thing where is that located in the scripts?

local function WeldTwoParts(A, B)
   local weld = Instance.new("WeldConstraint")
   weld.Parent = workspace
   weld.Part0 = A
   weld.Part1 = B
end

local Camera = workspace.CurrentCamera
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
if not Character or not Character.Parent then
   Character = Player.CharacterAdded:wait()
end
local HRP = Character.HumanoidRootPart
local Marble = workspace.Marble

wait(5)
character:SetPrimaryPartCFrame(Marble.CFrame)
WeldTwoParts(HRP, Marble)    

UserInputService.InputBegan:Connect(functon(input, gameProcessedEvent)
   local FakeUpVector = Vector3.new(0,1,0)
   local RightVector = Camera.CFrame.LookVector:Cross(FakeUpVector)
   local LeftVector = -RightVector
   local ForwardVector = Camera.CFrame.LookVector
   local BackVelocity = -ForwardVector

   if input.UserInputType == Enum.UserInputType.Keyboard then
      local key = input.KeyCode
      if key == Enum.KeyCode.W then
            local ForwardVelocity = Instance.new("BodyVelocity", Marble)
            ForwardVelocity.Name = "ForwardVelocity"
            ForwardVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
            ForwardVelocity.Velocity = ForwardVector*250
            ForwardVelocity.P = 1000
      elseif key == Enum.KeyCode.A then
            local LeftVelocity = Instance.new("BoddyVelocity", Marble)
            LeftVelocity.Name = "LeftVelocity"
            LeftVelocity.P = 10000 
            LeftVelocity.Velocity = LeftVector*250
      elseif key.Enum.KeyCode.D then
            local RightVelocity = Instance.new("BoddyVelocity", Marble)
            RightVelocity,Name = "RightVelocity"
            RightVelocity.P = 10000
            RightVelocity.Velocity = RightVector*250
      elseif key == Enum.KeyCode.S then
               local BackVelocity = Instance.new("BoddyVelocity", Marble)
               BackVelocity.Name = "BackVelocity"
               BackVelocity.P = 10000
               BackVelocity.Velocity = BackVelocity*250
            end
       end
 end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
   if input.UserInputType == Enum.UserInputType.KeyBoard then
      local key = input.KeyCode
      if key == Enum.KeyCode.W then
         if Marble:FindFirstChild("ForwardVelocity") then
            Marble.ForwardVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.A then
         if Marble:FindFirstChild("LeftVelocity") then
            Marble.LeftVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.D then
         if Marble:FindFirstChild("RightVelocity") then
            Marble.RightVelocity:Destroy()
         end
      end
      if key == Enum.KeyCode.S then
         if Marble:FindFirstChild("BackVelocity") then
            Marble.BackVelocity:Destroy()
         end
      end
   end
end)

Try this new code

2 Likes

It should be quite easy to adjust the code to switch in and out. Aside from platform stand and body movers (which you’d disable) all you should have to do is not run the update method on frame.

3 Likes

Iirc just comment out the lines in the onStep (whatever its called) method that set Gravity Up and Gravity Cframe

2 Likes

local function WeldTwoParts(A, B, P)
local weld = Instance.new(“WeldConstraint”, P)
weld.Parent = workspace
weld.Part0 = A
weld.Part1 = B
end
wait(2)
local Camera = workspace.CurrentCamera
local UserInputService = game:GetService(“UserInputService”)
local Player = game.Players.LocalPlayer
local Character = Player.Character

for i,v in pairs(Character:GetChildren())do
	if v:IsA("BasePart")then
		v.CanCollide = false
	end
end

if not Character or not Character.Parent then
   Character = Player.CharacterAdded:wait()
end
local density = .3
local friction = .1
local elasticity = 1
local frictionWeight = 1
local elasticityWeight = 1

local HRP = Character.PrimaryPart
local Marble = Instance.new("Part", workspace)
Marble.CFrame = CFrame.new(0,10,0)
Marble.Size = Vector3.new(11,11,11)
Marble.Transparency = 0.5
Marble.Shape = Enum.PartType.Ball
Marble.FrontSurface = Enum.SurfaceType.Smooth
Marble.BackSurface = Enum.SurfaceType.Smooth
Marble.LeftSurface = Enum.SurfaceType.Smooth
Marble.RightSurface = Enum.SurfaceType.Smooth
Marble.TopSurface = Enum.SurfaceType.Smooth
Marble.BottomSurface = Enum.SurfaceType.Smooth
Marble.Name = "Marble"
Marble.CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
local Animation = Character.Animate
wait(1)
Animation.Disabled = true
workspace.Marble.CFrame = CFrame.new(0,10,0)
Character:SetPrimaryPartCFrame(CFrame.new(0,10,0))
WeldTwoParts(Character.PrimaryPart, Marble, HRP)   
spawn(function()
local Attachment0 = Instance.new("Attachment", HRP)
local Attachment1 = Instance.new("Attachment", Marble)
local AlignOrientation = Instance.new("AlignOrientation", HRP)
AlignOrientation.Attachment0 = Attachment0
AlignOrientation.Attachment1 = Attachment1

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	local FakeUpVector = Vector3.new(0,1,0)
	local RightVector = Camera.CFrame.LookVector:Cross(FakeUpVector)
	local LeftVector = -RightVector
	local ForwardVector = Character.Head.CFrame.LookVector+ Camera.CFrame.LookVector

– local Theta = math.acos(Character.Head.LookVector:Dot(Camera.CFrame.LookVector))
local BackVelocity = -ForwardVector
Attachment0.CFrame = HRP.CFrame
Attachment1.CFrame = Marble.CFrame
local key = input.KeyCode
if key == Enum.KeyCode.W then
local ForwardVelocityForce = Instance.new(“BodyVelocity”, Marble)
ForwardVelocityForce.Name = “ForwardVelocityForce”
ForwardVelocityForce.MaxForce = Vector3.new(100 ,100 ,100)
ForwardVelocityForce.Velocity = ForwardVector100
ForwardVelocityForce.P = 10
elseif key == Enum.KeyCode.A then
local LeftVelocityForce = Instance.new(“BodyVelocity”, Marble)
LeftVelocityForce.Name = “LeftVelocityForce”
LeftVelocityForce.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
LeftVelocityForce.P = 10
LeftVelocityForce.Velocity = LeftVector
100
elseif key == Enum.KeyCode.D then
local RightVelocityForce = Instance.new(“BodyVelocity”, Marble)
RightVelocityForce.Name = “RightVelocityForce”
RightVelocityForce.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
RightVelocityForce.P = 10
RightVelocityForce.Velocity = RightVector100
elseif key == Enum.KeyCode.S then
local BackVelocityForce = Instance.new(“BodyVelocity”, Marble)
BackVelocityForce.Name = “BackVelocityForce”
BackVelocityForce.MaxForce = Vector3.new(100, 100, 100)
BackVelocityForce.P = 10
BackVelocityForce.Velocity = BackVelocity
100
end
end)

– while true do
– wait(0.5)
– Attachment0.CFrame = HRP.CFrame
– Attachment1.CFrame = Marble.CFrame
– end

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
      local key = input.KeyCode
      if key == Enum.KeyCode.W then
         if Marble:FindFirstChild("ForwardVelocityForce") then
            Marble.ForwardVelocityForce:Destroy()
         end
      end
      if key == Enum.KeyCode.A then
         if Marble:FindFirstChild("LeftVelocityForce") then
            Marble.LeftVelocityForce:Destroy()
         end
      end
      if key == Enum.KeyCode.D then
         if Marble:FindFirstChild("RightVelocityForce") then
            Marble.RightVelocityForce:Destroy()
         end
      end
      if key == Enum.KeyCode.S then
         if Marble:FindFirstChild("BackVelocityForce") then
            Marble.BackVelocityForce:Destroy()
      end
   end
end)

end)

@funkmeist123 see this link. The link:The link

I hope you realise

a. This thread has been solved already.
b. The post you linked points out the solution that was made in this thread.

It wouldn’t really be of any help to link this post. I was redirecting the OP of that thread to this one for its solution, as the questions were the same.

Please make sure to read through a thread’s replies before replying.

4 Likes

Which script is it in the three script sections.

1 Like

Hello EgoMoose, I wanted to ask, how can I make character go into ball and look like in that video, because mine stands on the ball

2 Likes