How do I make a player marble

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

This is because the character parts are colliding with the ball. Just set each CanCollide property of each Player part to false and it should now be inside the ball. Its the ball that need to collide, not the player self.

1 Like

This is so sweet I stumbled on this! Does anyone have a working EDITable published new example of this concept?

Ehm. This isn‘t at this hard. Try first. Yourself. Don‘t ask other that they do all for you. If then your method didn‘t work, ask here and show your code.

Ok thanks, I have checked it out and adding to it!

3 Likes

hello, I tried making the player become a marble when touching a part, and it will be gone when reseted, do you know how do i do that?
(i know it does something with script.Parent.Touched:Connect(function(hit). )

I don’t coded for several months now, can’t help, sorry

1 Like

Sorry for bumping into this topic, but i’m pretty sure the cancollide properties of parts inside models with humanoids are updated each frame, so that wouldn’t do anything.

2 Likes

Is there a way that it can be updated each frame so that cancollide is always off? I’m new to scripting aswell and don’t know how to do it (sorry for bumb)

1 Like

I guess you could use BindToRenderStepped so a function that makes the limbs of the player uncollideable runs every single frame, but don’t do that.

You don’t need to make the player’s limbs uncollideable to put them in a marble. Just use a ManualWeld. That’s how I make player marbles.

1 Like