Advertisement
TheYoutuber_Pro

normal ball (normal orb not trail)

Apr 23rd, 2022
1,317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 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.5, 0.5, 0.5), Color = Color3.new(1, 1, 1), FacingCamera = true, Distance = -5, beamEnabled = true}
  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. })
  33.  
  34. local att1 = new("Attachment", {
  35.     Parent = rootPart
  36. })
  37.  
  38. game:GetService("RunService").Heartbeat:Connect(function()
  39.     rotation = rotation + 1.5
  40.     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)
  41.    
  42.     if orbsettings.beamEnabled then
  43.         local connector = new("Beam", {
  44.             Parent = rootPart,
  45.             Color = ColorSequence.new(orbsettings.Color),
  46.             FaceCamera = orbsettings.FacingCamera,
  47.             Transparency = NumberSequence.new(0, 0);
  48.             Attachment0 = att0,
  49.             Attachment1 = att1,
  50.             Width0 = 0.05,
  51.             Width1 = 0.05,
  52.         })
  53.     else
  54.         -- ignore
  55.     end
  56. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement