How do I make a player marble

Sorry for holding you up for so long but this happened now:

1 Like
game.Players.PlayerAdded:Connect(funtion(player)
     local Marble = workspace.Marble
     local function WeldTwoParts(A, B)
        local weld = Instance.new("WeldConstraint")
        weld.Parent = workspace
        weld.Part0 = A
        weld.Part1 = B
     end
     wait(5)
     Character:SetPrimaryPartCFrame(Marble.CFrame)
     WeldTwoParts(player.Character.HumanoidRootPart, Marble)
end)
1 Like

@funkmeist123, when you hover the Mouse over the error, what say the System?

1 Like

I fixed a few errors in your code, including how you misspelled “function” on line 1.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local Marble = workspace.Marble
        local function WeldTwoParts(A, B)
            local weld = Instance.new("WeldConstraint")
            weld.Parent = workspace
            weld.Part0 = A
            weld.Part1 = B
        end
        wait(1)
        character:SetPrimaryPartCFrame(Marble.CFrame)
        WeldTwoParts(character.HumanoidRootPart, Marble)
    end)
end)
2 Likes

Ok so the marble works just it won’t roll it just kinda adds a sphere around my player:


like this.

The ball could be anchored that’s probably why.

1 Like

Actually I already turned off anchoring since it was creating problems.

You need to create a loop which adds to a bodyvelocity in the ball by the character humanoid’s move direction, and turn on platformstanding in the humanoid as well

2 Likes

where do I put the platform standing localscript?

Just put all of it in a localscript inside of a while wait do loop

1 Like

Wait what do you mean by a loop that adds to a bodyvelocity, sorry if that’s a obvious question i’m very new to scripting.

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…

21 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