Advertisement
TheYoutuber_Pro

ball trail (orb)

Apr 23rd, 2022
1,030
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. --[[
  2. name: roblox-simple-orb
  3. author: Aldanium/recursion/Fernando Goncalves
  4. ]]--
  5.  
  6. local orbsettings = {Size = Vector3.new(0.7, 0.7, 0.7), Color = Color3.new(1, 1, 1), FacingCamera = true, Distance = -5}
  7. local rotation = 0
  8.  
  9. local character = owner.Character
  10. local rootPart = character['HumanoidRootPart']
  11.  
  12. local new = function(object, ...)
  13.     local Object = Instance.new(object)
  14.     for i,v in pairs(...) do
  15.         Object[i] = v
  16.     end
  17.     return Object
  18. end
  19.  
  20. local orb = new("Part", {
  21.     Anchored = true,
  22.     CanCollide = false,
  23.     Material = "SmoothPlastic",
  24.     Shape = Enum.PartType.Ball,
  25.     Size = orbsettings.Size,
  26.     Color = orbsettings.Color,
  27.     Parent = script
  28. })
  29.  
  30. local att0 = new("Attachment", {
  31.     Parent = orb,
  32.     Position = Vector3.new(0, 0, -0.3)
  33. })
  34.  
  35. local att1 = new("Attachment", {
  36.     Parent = orb,
  37.     Position = Vector3.new(0, 0, 0.3)
  38. })
  39.  
  40. local orbTrail = new("Trail", {
  41.     Parent = orb,
  42.     Attachment0 = att0,
  43.     Attachment1 = att1,
  44.     WidthScale = NumberSequence.new(1, 0),
  45.     FaceCamera = orbsettings.FacingCamera,
  46.     Lifetime = 1
  47. })
  48.  
  49. game:GetService("RunService").Heartbeat:Connect(function()
  50.     rotation = rotation + 1.5
  51.     orb.CFrame = CFrame.new(rootPart.CFrame.p) * CFrame.Angles(math.sin(math.rad(rotation)), math.rad(rotation), math.cos(math.rad(rotation))) * CFrame.new(0, 0, orbsettings.Distance)
  52. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement