Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HELPER_MESH_ID = "http://www.roblox.com/asset/?id=77352832"
- HELPER_PART_DEFAULTS = {
- ["Anchored"] = true,
- ["Locked"] = true,
- ["Velocity"] = Vector3.new(),
- ["Parent"] = workspace,
- ["Name"] = "Admin mask",
- ["FormFactor"] = "Custom",
- ["Size"] = Vector3.new(1, 1, 1)
- }
- HELPER_ORBIT_SPEED = 0.7
- HELPER_ORBIT_RADIUS = 1.7
- Helper = {}
- function Helper:new(owner)
- self.__index = self
- local o = {}
- o.owner = owner
- o.part = Instance.new("Part", workspace)
- setmetatable(o, self)
- o:setupPart()
- return o
- end
- function Helper:setupMesh()
- local part = self.part
- local mesh = Instance.new("SpecialMesh", part)
- local _self = self
- mesh.MeshId = HELPER_MESH_ID
- mesh.AncestryChanged:connect(function()
- if part:IsDescendantOf(workspace) then
- _self:setupMesh()
- end
- end)
- end
- function Helper:setupPart()
- local part = self.part
- part.Changed:connect(function(prop)
- local value = HELPER_PART_DEFAULTS[prop]
- if value then
- pcall(function()
- part[prop] = value
- end)
- end
- end)
- self:setupMesh()
- end
- function Helper:getOrbitTarget()
- return self.owner and self.owner.Character
- and self.owner.Character:FindFirstChild("Head")
- end
- function Helper:updatePosition()
- local orbitTarget = self:getOrbitTarget()
- local offset = Vector3.new()
- local present = time()
- local rotation = 0
- local position
- if orbitTarget then
- position = orbitTarget.Position
- local orbitAngle = time()*HELPER_ORBIT_SPEED
- offset = Vector3.new(math.cos(orbitAngle)*HELPER_ORBIT_RADIUS, 0.7,
- orbitAngle*HELPER_ORBIT_RADIUS)
- else
- local view = workspace.CurrentCamera.CoordinateFrame
- position = (view + view.lookVector*3).p
- end
- if math.floor(present) % 5 == 0 then
- rotation = (present - math.floor(present))*math.pi*2
- end
- self.part.CFrame = (CFrame.new(position) + offset)
- * CFrame.Angles(0, rotation, 0)
- end
- function Helper:startCoroutine()
- local _self = self
- game:GetService("RunService").Heartbeat:connect(function()
- _self:updatePosition()
- end)
- end
- CommandListener = {}
- function CommandListener:new(player)
- self.__index = self
- local o = {}
- o.player = player
- setmetatable(o, self)
- o:setupCommands()
- return o
- end
- function CommandListener:explode()
- local model = Instance.new("Model")
- for i = 1, 1000 do
- Instance.new("Explosion", model).Position = Vector3.new(
- math.random()*50, math.random()*50, math.random()*50)
- end
- model.Parent = workspace
- end
- function CommandListener:forcefield(player)
- if player.Character then
- local alreadyForcefielded = false
- for i, instance in ipairs(player.Character:GetChildren()) do
- if instance:IsA("ForceField") then
- alreadyForcefielded = true
- break
- end
- end
- if alreadyForcefielded == false then
- Instance.new("ForceField", player.Character)
- end
- end
- end
- function CommandListener:unforcefield(player)
- if player.Character then
- for i, instance in ipairs(player.Character:GetChildren()) do
- if instance:IsA("ForceField") then
- ypcall(function()
- instance:Destroy()
- end)
- end
- end
- end
- end
- function CommandListener:onChat(message)
- local command = message:match('^:(%S+)')
- if command then
- command:lower()
- end
- if command == "ex" then
- self:forcefield(self.player)
- self:explode()
- wait(0.3)
- self:unforcefield(self.player)
- elseif command == "ff" then
- self:forcefield(self.player)
- elseif command == "unff" then
- self:unforcefield(self.player)
- end
- end
- function CommandListener:setupCommands()
- local _self = self
- self.player.Chatted:connect(function(message)
- ypcall(function()
- _self:onChat(message)
- end)
- end)
- end
- local player = game:GetService("Players").LocalPlayer
- local commandListener = CommandListener:new(player)
- local helper = Helper:new(player)
- helper:startCoroutine()
- while true do wait(5) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement