Advertisement
DracoFAAD

ModelCreatorLibrary

May 3rd, 2023 (edited)
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. local hologramCreatorModule = loadstring(game:HttpGet("https://pastebin.com/raw/03XaA2Z6"))()
  2.  
  3. local Players = game:GetService("Players")
  4. local localPlayer = Players.LocalPlayer
  5.  
  6. local module = {}
  7.  
  8. module.Holograms = {}
  9.  
  10. local faces = {
  11. ["Left"] = 90, ["Right"] = -90, ["About"] = 180, ["Center"] = "CENTER", ["Control"] = "CONTROL"
  12. }
  13.  
  14. local inclines = {
  15. ["Left"] = 45, ["Right"] = -45
  16. }
  17.  
  18. local types = {
  19. ["Face!"] = faces, ["Incline!"] = inclines
  20. }
  21.  
  22. local function RemoveZRotation(cframe)
  23. local x, y, z = cframe:ToOrientation()
  24. return CFrame.new(cframe.Position) * CFrame.Angles(x,y,0)
  25. end
  26.  
  27. function module.Instantiate(position)
  28. local stop = false
  29. local hologram = {}
  30. hologram.Instance = hologramCreatorModule.Instantiate()
  31. hologram.Instance:SetPrimaryPartCFrame(position)
  32. local instance = hologram.Instance
  33. table.insert(module.Holograms, hologram)
  34.  
  35. local listensTo = localPlayer
  36.  
  37. function msged(msg)
  38. msg = msg:gsub(" ", "")
  39. local args = msg:split(",")
  40. if #args == 2 then
  41. if args[2]:sub(#args[2], #args[2]) == "!" then
  42. local face = args[1]
  43. local type = args[2]
  44. local typeTable = types[type]
  45.  
  46. if typeTable[face] then
  47. local rotation = typeTable[face]
  48. if listensTo.Character then
  49. local lChar = listensTo.Character
  50. if tonumber(rotation) then
  51. if stop then return end
  52. local newRotation = instance:GetPivot() * CFrame.fromEulerAnglesXYZ(0, math.rad(rotation), 0)
  53. instance:SetPrimaryPartCFrame(newRotation)
  54. else
  55. --Its special; Center or Control.
  56. if rotation == "CENTER" then
  57. stop = false
  58. local currentRotation = lChar:GetPivot().Rotation
  59. local newRotation = CFrame.new(instance:GetPivot().Position) * currentRotation * CFrame.fromEulerAnglesXYZ(0, math.rad(180), 0)
  60. instance:SetPrimaryPartCFrame(newRotation)
  61. end
  62.  
  63. if rotation == "CONTROL" then
  64. local x,y,z = instance:GetPivot():ToOrientation()
  65. stop = true
  66. repeat
  67. local lookAtRotation = CFrame.lookAt(instance:GetPivot().Position, lChar:GetPivot().Position, instance:GetPivot().UpVector)
  68. local newRotation = lookAtRotation
  69. print(newRotation.Rotation.Y)
  70. local nx, ny, nz = newRotation:ToOrientation()
  71. newRotation = CFrame.new(newRotation.Position) * CFrame.fromEulerAnglesXYZ(x, ny, z)
  72. instance:SetPrimaryPartCFrame(newRotation)
  73. wait()
  74. until stop == false
  75. end
  76. end
  77. end
  78. end
  79. end
  80. end
  81. end
  82.  
  83. local lastConnection = listensTo.Chatted:Connect(msged)
  84.  
  85. hologram.listen = function(plr)
  86. if lastConnection then
  87. lastConnection:Disconnect()
  88. lastConnection = nil
  89. end
  90. listensTo = plr
  91. lastConnection = plr.Chatted:Connect(msged)
  92. end
  93.  
  94. hologram.destroy = function()
  95. if lastConnection then
  96. lastConnection:Disconnect()
  97. lastConnection = nil
  98. end
  99.  
  100. hologram.Instance:Destroy()
  101. end
  102.  
  103. return hologram
  104. end
  105.  
  106. --Example: module.Instantiate(workspace.Iliketomoveit007:GetPivot())
  107. return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement