What is the Character.PrimaryPart
, Does it points to the player’s character’s primary part?
It’s for the primary part. It gets HumanoidRootPart for the script
I want the ball to increase the roll speed when you roll long enough.
Just use an loop / tween to change the humanoid WalkSpeed
And I want to make the ball stop rolling if the player stops moving the ball.
loop or tween the WalkSpeed
but on TouchEnded
which checks if the player stopped touching the ball.
The roll doesn’t work…
local BALL = script.Parent.Parent
local speed = BALL.speed
BALL.PrimaryPart.Touched:Connect(function(touch)
local character = touch.Parent
local HRP = character.PrimaryPart
if touch.Parent:FindFirstChild("Humanoid") then
wait(0.1)
BALL.Humanoid:MoveTo(HRP.Position + HRP.CFrame.LookVector * speed.Value)
end
end)
because its a ball, you can probably use something like AlignPosition
or LinearVelocity
and it should be able to stick to the ground for Rotation.
How, They did this rolling system with scripts.
You use the script to move the ball where using these things, and the script tell the ball where to go and when a player touched it.
the ball looks liked it was moved by roblox physics.
I want to roll the ball on player’s facing direction.
do you mean where the player is looking?
You can probably still get the players CFrame.LookVector
and use the Linear velocity to move that way.
and in the video it looks like the player is floating over the ball.
So probably another part and collision group were used.
I do not have access to my pc right now but I will tey to replicate it tomorrow.
Ok then, Tell me when you replicated it.
I have finally done it with TagEditor, CollisionGroups and Physics thing.
I put this ball in workspace
Ball.rbxm (6.2 KB)
this is the video of it working
Here is the Script I put in StarterCharacter
ClientScript
local Player=game:GetService('Players').LocalPlayer
local Character=script.Parent::Model&{HumanoidRootPart:BasePart}
local Humanoid:Humanoid=Character.Humanoid
local Runservice=game:GetService('RunService')
local CurrentBall
local Speed=20
Humanoid.Touched:Connect(function(part)
if CurrentBall then
return
end
local Model=part.Parent
if not Model and Model:HasTag("Ball") and part.Name=="Touch" then
return
end
local Ball=Model:FindFirstChild('Ball')
local Move:BasePart=Model:FindFirstChild('Move')
if Ball and Move then
part.TouchEnded:Connect(function(otherPart)
if CurrentBall and otherPart.Parent==Character then
CurrentBall.Ball.LinearVelocity.VectorVelocity=Vector3.zero
CurrentBall=nil
end
end)
CurrentBall=Model
end
end)
Runservice:BindToRenderStep("MoveBall",2000,function()
if not CurrentBall then
return
end
local Look=Character.HumanoidRootPart.CFrame.LookVector
CurrentBall.Ball.LinearVelocity.VectorVelocity=Look*Speed
end)
And here is the script I put in ServerScriptService
serverscript
local Players=game:GetService('Players')
local CollectionService=game:GetService('CollectionService')
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
for c,v:Instance in pairs(Character:GetDescendants()) do
if v:IsA('BasePart') then
v.CollisionGroup='Player'
end
end
end)
end)
But, How do I stop the ball from rolling when the ball touches the part that will stop the ball.