When I make a ball that I am inside of how do I make it so that it rolls when I move? Right now it just suspends me in midair and moves but doesn't roll. This is my code:
local PhysicsService = game:GetService("PhysicsService")
local Players = "Players"
local Ball = "Ball"
function weld(x, y)
local weld = Instance.new("Weld", x)
weld.Part0 = x
weld.Part1 = y
weld.Parent = x
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
for _,inst in pairs (character:GetChildren()) do
if inst:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(inst, Players)
end
end
end)
player.Chatted:Connect(function(msg)
local args = msg:split(" ")
if msg == "ball" or msg == "/e ball" or msg == "Ball" or msg == "/e Ball" then
local Character = player.Character
local Root = Character:WaitForChild("HumanoidRootPart")
------------------------------------------------------------
local part = Instance.new("Part")
part.Name = "Ball"
part.Shape = Enum.PartType.Ball
part.Transparency = 0
part.Size = Vector3.new(15,15,15)
PhysicsService:SetPartCollisionGroup(part, Ball)
part.Anchored = false
part.CFrame = Root.CFrame
part.Massless = true
part.Material = Enum.Material.ForceField
part.BrickColor = BrickColor.new("Light blue")
---------------------------------------------
local descendants = player.Character:GetDescendants()
for _,inst in pairs(descendants) do
if inst:IsA("BasePart") and inst.CanCollide then
local noCollisionConstraint = Instance.new("NoCollisionConstraint")
noCollisionConstraint.Parent = part
noCollisionConstraint.Part0 = inst
noCollisionConstraint.Part1 = part
end
end
part.Parent = workspace
weld(Root, part)
end
end)
end)

2 comments
If you mean with WASD movement, idk. But having something which already has a velocity collide with the ball could pass a bit of the velocity onto the ball and making it roll.
=/