Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hologramCreatorModule = loadstring(game:HttpGet("https://pastebin.com/raw/03XaA2Z6"))()
- local Players = game:GetService("Players")
- local localPlayer = Players.LocalPlayer
- local module = {}
- module.Holograms = {}
- local faces = {
- ["Left"] = 90, ["Right"] = -90, ["About"] = 180, ["Center"] = "CENTER", ["Control"] = "CONTROL"
- }
- local inclines = {
- ["Left"] = 45, ["Right"] = -45
- }
- local types = {
- ["Face!"] = faces, ["Incline!"] = inclines
- }
- local function RemoveZRotation(cframe)
- local x, y, z = cframe:ToOrientation()
- return CFrame.new(cframe.Position) * CFrame.Angles(x,y,0)
- end
- function module.Instantiate(position)
- local stop = false
- local hologram = {}
- hologram.Instance = hologramCreatorModule.Instantiate()
- hologram.Instance:SetPrimaryPartCFrame(position)
- local instance = hologram.Instance
- table.insert(module.Holograms, hologram)
- local listensTo = localPlayer
- function msged(msg)
- msg = msg:gsub(" ", "")
- local args = msg:split(",")
- if #args == 2 then
- if args[2]:sub(#args[2], #args[2]) == "!" then
- local face = args[1]
- local type = args[2]
- local typeTable = types[type]
- if typeTable[face] then
- local rotation = typeTable[face]
- if listensTo.Character then
- local lChar = listensTo.Character
- if tonumber(rotation) then
- if stop then return end
- local newRotation = instance:GetPivot() * CFrame.fromEulerAnglesXYZ(0, math.rad(rotation), 0)
- instance:SetPrimaryPartCFrame(newRotation)
- else
- --Its special; Center or Control.
- if rotation == "CENTER" then
- stop = false
- local currentRotation = lChar:GetPivot().Rotation
- local newRotation = CFrame.new(instance:GetPivot().Position) * currentRotation * CFrame.fromEulerAnglesXYZ(0, math.rad(180), 0)
- instance:SetPrimaryPartCFrame(newRotation)
- end
- if rotation == "CONTROL" then
- local x,y,z = instance:GetPivot():ToOrientation()
- stop = true
- repeat
- local lookAtRotation = CFrame.lookAt(instance:GetPivot().Position, lChar:GetPivot().Position, instance:GetPivot().UpVector)
- local newRotation = lookAtRotation
- print(newRotation.Rotation.Y)
- local nx, ny, nz = newRotation:ToOrientation()
- newRotation = CFrame.new(newRotation.Position) * CFrame.fromEulerAnglesXYZ(x, ny, z)
- instance:SetPrimaryPartCFrame(newRotation)
- wait()
- until stop == false
- end
- end
- end
- end
- end
- end
- end
- local lastConnection = listensTo.Chatted:Connect(msged)
- hologram.listen = function(plr)
- if lastConnection then
- lastConnection:Disconnect()
- lastConnection = nil
- end
- listensTo = plr
- lastConnection = plr.Chatted:Connect(msged)
- end
- hologram.destroy = function()
- if lastConnection then
- lastConnection:Disconnect()
- lastConnection = nil
- end
- hologram.Instance:Destroy()
- end
- return hologram
- end
- --Example: module.Instantiate(workspace.Iliketomoveit007:GetPivot())
- return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement