local ts = game:GetService("TweenService")
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
local char = plr.Character
local hrp = char.HumanoidRootPart
local ball = game.ReplicatedStorage.Ball:Clone()
local tween = ts:Create(ball, TweenInfo.new(0.8, Enum.EasingStyle.Cubic), {Size = Vector3.new(7,7,7)})
ball.Position = hrp.Position + hrp.CFrame.LookVector * 7 + Vector3.new(0,3,0)
ball.Parent = workspace
tween:Play()
local LV = Instance.new("LinearVelocity", ball)
LV.Attachment0 = ball.Attachment
LV.MaxForce = 10
LV.VectorVelocity = Vector3.new(1,1,1)
end)
When you say disappear, do you mean moves away really quickly?
Judging by your code, the ball disappears after adding linear velocity because you’re setting the VectorVelocity
property to (1,1,1)
, which means the ball will move very quickly along the direction (1,1,1)
.
If you want the ball to move in a specific direction, you should adjust the VectorVelocity
accordingly. For example, if you want the ball to move forward along the direction the player is facing, you can use the player’s HumanoidRootPart’s CFrame.LookVector
as the direction.
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
local char = plr.Character
local hrp = char:WaitForChild("HumanoidRootPart") -- Wait for the character to load
local ball = game.ReplicatedStorage.Ball:Clone()
local tween = ts:Create(ball, TweenInfo.new(0.8, Enum.EasingStyle.Cubic), {Size = Vector3.new(7,7,7)})
ball.Position = hrp.Position + hrp.CFrame.LookVector * 7 + Vector3.new(0,3,0)
ball.Parent = workspace
tween:Play()
local LV = Instance.new("LinearVelocity", ball)
LV.Attachment0 = ball.Attachment
LV.MaxForce = 10
LV.VectorVelocity = hrp.CFrame.LookVector * 50 -- Adjust the speed as needed
end)
Is the ball CanCollide true or false? It may just be dropping through the baseplate after it’s cloned in.
Seems strange you are tweening it (that would mean it’s Anchored) and then putting a LinearVelocity in it (which applies to unanchored Parts).