Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game:GetObjects("rbxassetid://501559112")[1].Parent=game.Workspace
- wait(0.5)
- game.Workspace.Towers:MoveTo(game.Players.LocalPlayer.Character.Torso.Position + game.Players.LocalPlayer.Character.Torso.CFrame.lookVector* 30)
- wait(2)
- game:GetObjects("rbxassetid://654695896")[1].Parent=game.Players.LocalPlayer.Backpack
- wait(0.5)
- Tool = game.Players.LocalPlayer.Backpack:FindFirstChild("MagicCarpet") or game.Players.LocalPlayer.Character:FindFirstChild("MagicCarpet")
- local stillEquipped = false
- function onEquippedLocal(mouse)
- stillEquipped = true
- if mouse == nil then
- print("Mouse not found")
- return
- end
- while stillEquipped do
- print("Setting Mouse to go")
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- while Tool.Enabled and stillEquipped do
- wait(0.01)
- end
- print("Setting Mouse to wait")
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- while not Tool.Enabled and stillEquipped do
- wait(0.01)
- end
- end
- end
- function onUnequippedLocal()
- stillEquipped = false
- end
- Tool.Equipped:connect(onEquippedLocal)
- Tool.Unequipped:connect(onUnequippedLocal)
- local Tool = game.Players.LocalPlayer.Backpack:FindFirstChild("MagicCarpet") or game.Players.LocalPlayer.Character:FindFirstChild("MagicCarpet")
- local Carpet = Tool.Handle
- function waitForChild(parent, instance)
- while parent:FindFirstChild(instance) == nil do
- print("Waiting for" .. instance)
- wait()
- end
- end
- waitForChild(Tool, "CarpetB1Weld")
- waitForChild(Tool, "CarpetB2Weld")
- waitForChild(Tool, "CarpetTailWeld")
- waitForChild(Carpet, "CarpetB1")
- waitForChild(Carpet, "CarpetB2")
- waitForChild(Carpet, "CarpetTail")
- local carpetB1Weld = Tool.CarpetB1Weld
- local carpetB2Weld = Tool.CarpetB2Weld
- local carpetTailWeld = Tool.CarpetTailWeld
- local carpetB1 = Carpet.CarpetB1
- local carpetB2 = Carpet.CarpetB2
- local carpetTail = Carpet.CarpetTail
- local sparkles
- local flightSpin
- local flightPower
- local flightHold
- local cooldownCo
- local vCharacter
- local myTorso
- local myHumanoid
- local fire
- local carpetActive
- local debris = game:GetService("Debris")
- Tool.Enabled = true
- local santaSound
- local giftAssets = {6125503, 6203087, 66897125, 41452698}
- function tagHumanoid(humanoid, player)
- if humanoid ~= nil then
- creator = Instance.new("ObjectValue")
- creator.Parent = humanoid
- creator.Value = player
- creator.Name = "creator"
- debris:AddItem(creator, 1)
- end
- end
- function cooldown()
- Carpet.Transparency = 1.0
- if carpetTail then
- sparkles = Instance.new("Sparkles")
- sparkles.Parent = carpetTail
- end
- local duration = 40.0
- local sign = -1
- local count = 0
- local initTailC1
- local initB1C1
- local initB2C1
- if carpetTailWeld then
- initTailC1 = carpetTailWeld.C1
- end
- if carpetB1Weld then
- initB1C1 = carpetB1Weld.C1
- end
- if carpetB2Weld then
- initB2C1 = carpetB2Weld.C1
- end
- if carpetB1 then
- carpetB1.Mesh.MeshId = "http://www.roblox.com/asset/?id=161268656"
- end
- while duration > 0 do
- duration = duration - wait()
- if carpetTailWeld and carpetB1Weld and carpetB2Weld then
- carpetTailWeld.C1 = CFrame.Angles(-sign * math.pi/100, 0, 0) * carpetTailWeld.C1
- carpetB1Weld.C1 = CFrame.Angles(-sign * math.pi/100, 0, 0) * carpetB1Weld.C1
- carpetB2Weld.C1 = CFrame.Angles(sign * math.pi/100, 0, 0) * carpetB2Weld.C1
- if count%8 == 0 then
- sign = sign * -1
- end
- count = count + 1
- end
- wait()
- end
- if carpetTailWeld then
- carpetTailWeld.C1 = initTailC1
- end
- if carpetB1Weld then
- carpetB1Weld.C1 = initB1C1
- end
- if carpetB2Weld then
- carpetB2Weld.C1 = initB2C1
- end
- if flightSpin then flightSpin:Remove() end
- if flightPower then flightPower:Remove() end
- if flightHold then flightHold:Remove() end
- ratio = myHumanoid.Health/myHumanoid.MaxHealth
- myHumanoid.MaxHealth = 100
- wait(0.1)
- myHumanoid.Health = ratio * 100
- Tool.Enabled = false
- if fire then fire:Remove() end
- if sparkles then sparkles:Remove() end
- carpetUp()
- wait(15.0)
- Tool.Enabled = true
- if carpetActive then carpetActive.Value = 0 end
- if carpetB1 then
- carpetB1.Mesh.MeshId = "http://www.roblox.com/asset/?id=161268656"
- end
- Carpet.Transparency = 0.0
- end
- function carpetUp()
- Tool.GripForward = Vector3.new(-0.006, 0, -1)
- Tool.GripUp = Vector3.new(0.049, 0.999, -0)
- Tool.GripRight = Vector3.new(0.999, -0.049, -0.006)
- Tool.GripPos = Vector3.new(1.508, 2.326, -4.143)
- end
- function carpetMid()
- Tool.GripForward = Vector3.new(-0.006, 0, -1)
- Tool.GripUp = Vector3.new(0.049, 0.999, -0)
- Tool.GripRight = Vector3.new(0.999, -0.049, -0.006)
- Tool.GripPos = Vector3.new(1.508, 2.326, -4.143)
- end
- function onActivated()
- vCharacter = Tool.Parent
- if vCharacter ~= nil then
- myHumanoid = vCharacter:FindFirstChild("Humanoid")
- if myHumanoid then
- myTorso = vCharacter:FindFirstChild("Torso")
- carpetActive = Tool:FindFirstChild("CarpetActive")
- if myTorso then
- if cooldownCo == nil or coroutine.status(cooldownCo) == 'dead' then
- --Carpet.Transparency = 1.0
- carpetMid()
- ratio = myHumanoid.Health/myHumanoid.MaxHealth
- myHumanoid.MaxHealth = 200
- wait(0.1)
- myHumanoid.Health = ratio * 200
- flightSpin = myTorso:FindFirstChild("FlightSpin")
- flightPower = myTorso:FindFirstChild("FlightPower")
- flightHold = myTorso:FindFirstChild("FlightHold")
- if flightSpin ~= nil or flightPower ~= nil or flightHold ~= nil then debounce = false return end
- if carpetActive then print("Setting Carpet Active") carpetActive.Value = 1 end
- flightSpin = Instance.new("BodyGyro")
- flightPower = Instance.new("BodyVelocity")
- flightHold = Instance.new("BodyPosition")
- flightHold.Name = "FlightHold"
- flightHold.P = 100000
- flightHold.maxForce = Vector3.new(0,0,0)
- flightPower.Name = "FlightPower"
- flightPower.velocity = Vector3.new(0,0,0)
- flightPower.P = 1000000
- flightPower.maxForce = Vector3.new(flightPower.P, flightPower.P, flightPower.P)
- flightPower.P = 10000
- flightSpin.Name = "FlightSpin"
- flightSpin.P = 1000000
- flightSpin.maxTorque = Vector3.new(flightSpin.P, flightSpin.P, flightSpin.P)
- flightSpin.cframe = myTorso.CFrame
- flightSpin.Parent = myTorso
- flightHold.position = myTorso.Position
- flightHold.Parent = myTorso
- flightPower.Parent = myTorso
- myTorso.Velocity = Vector3.new(0,0,0)
- myTorso.RotVelocity = Vector3.new(0,0,0)
- myHumanoid.Sit = true
- cooldownCo = coroutine.create(cooldown)
- coroutine.resume(cooldownCo)
- end
- end
- end
- end
- end
- function onEquipped()
- vCharacter = Tool.Parent
- myTorso = vCharacter:FindFirstChild("Torso")
- myHumanoid = vCharacter:FindFirstChild("Humanoid")
- vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
- if carpetB1Weld then carpetB1Weld.Parent = Tool end
- if carpetB2Weld then carpetB2Weld.Parent = Tool end
- if carpetTailWeld then carpetTailWeld.Parent = Tool end
- end
- function onUnequipped()
- if flightPower then flightPower:remove() end
- if flightSpin then flightSpin:remove() end
- if flightHold then flightHold:remove() end
- if myHumanoid then
- ratio = myHumanoid.Health/myHumanoid.MaxHealth
- myHumanoid.MaxHealth = 100
- wait(0.1)
- myHumanoid.Health = ratio * 100
- end
- carpetUp()
- if santaSound then santaSound:Stop() end
- if sparkles then sparkles:Remove() end
- Carpet.Transparency = 0.0
- if carpetB1 then
- carpetB1.Mesh.MeshId = "http://www.roblox.com/asset/?id=161268656"
- end
- end
- Tool.Activated:connect(onActivated)
- Tool.Equipped:connect(onEquipped)
- Tool.Unequipped:connect(onUnequipped)
- local Tool = game.Players.LocalPlayer.Backpack:FindFirstChild("MagicCarpet") or game.Players.LocalPlayer.Character:FindFirstChild("MagicCarpet")
- local flightPower
- local flightSpin
- local flightHold
- local camSpeedZ = 60
- local camSpeedX = 40
- local forwards = false
- local back = false
- local left = false
- local right = false
- local unEquipped = false
- local movementHandlerCo
- local hover = -.1
- local carpetActive
- local myTorso
- local vCharacter
- local myHumanoid
- function handleMovementFrame()
- local newPush = Vector3.new(0,0,0)
- local forwardVector = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 0, -1))
- if forwards and not back then newPush = forwardVector * camSpeedZ end
- if back and not forwards then newPush = newPush + forwardVector * -camSpeedZ end
- if left and not right then newPush = newPush + game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(-1, 0, 0)) * camSpeedX end
- if right and not left then newPush = newPush + game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(1, 0, 0)) * camSpeedX end
- flightSpin.cframe = CFrame.new(Vector3.new(0,0,0), forwardVector) -- have torso face forwards
- if newPush.magnitude < 1 then
- flightHold.maxForce = Vector3.new(flightHold.P, flightHold.P, flightHold.P)
- flightPower.maxForce = Vector3.new(0, 0, 0)
- if myTorso then flightHold.position = myTorso.Position end
- else
- flightHold.maxForce = Vector3.new(0, 0, 0)
- flightPower.maxForce = Vector3.new(flightPower.P*100, flightPower.P*100, flightPower.P*100)
- end
- flightPower.velocity = newPush
- end
- function handleMovement()
- carpetActive = Tool:FindFirstChild("CarpetActive")
- if carpetActive then
- while carpetActive.Value == 1 do
- handleMovementFrame()
- if not unEquipped then if myHumanoid then myHumanoid.Sit = true end end
- wait()
- end
- end
- end
- function keyUpFunc(key)
- if key == nil then return end
- local key = key:lower()
- if key == "w" then
- forwards = false
- elseif key == "a" then
- left = false
- elseif key == "s" then
- back = false
- elseif key == "d" then
- right = false
- end
- end
- function keyDownFunc(key)
- if key == nil then return end
- local key = key:lower()
- if key == "w" then
- forwards = true
- elseif key == "a" then
- left = true
- elseif key == "s" then
- back = true
- elseif key == "d" then
- right = true
- end
- end
- function carpetActivate()
- carpetActive = Tool:FindFirstChild("CarpetActive")
- if carpetActive then
- if carpetActive.Value == 0 then return end
- end
- local vCharacter = Tool.Parent
- myTorso = vCharacter:FindFirstChild("Torso")
- if myTorso == nil then return end
- flightPower = vCharacter.Torso:FindFirstChild("FlightPower")
- flightSpin = vCharacter.Torso:FindFirstChild("FlightSpin")
- flightHold = vCharacter.Torso:FindFirstChild("FlightHold")
- while flightPower == nil or flightSpin == nil or flightHold == nil do
- Tool.Parent.Torso.ChildAdded:wait()
- flightPower = Tool.Parent.Torso:FindFirstChild("FlightPower")
- flightSpin = Tool.Parent.Torso:FindFirstChild("FlightSpin")
- flightHold = Tool.Parent.Torso:FindFirstChild("FlightHold")
- end
- print("Handling Movement")
- movementHandlerCo = coroutine.create(handleMovement)
- coroutine.resume(movementHandlerCo)
- end
- function onEquipped(mouse)
- print("Equipped")
- if mouse then
- forwards = false
- back = false
- left = false
- right = false
- mouse.KeyDown:connect(keyDownFunc)
- mouse.KeyUp:connect(keyUpFunc)
- end
- vCharacter = Tool.Parent
- myHumanoid = vCharacter:FindFirstChild("Humanoid")
- carpetActive = Tool:FindFirstChild("CarpetActive")
- if carpetActive then print("Connection established") carpetActive.Changed:connect(carpetActivate) end
- end
- function onUnequipped()
- unEquipped = true
- end
- Tool.Equipped:connect(onEquipped)
- Tool.Unequipped:connect(onUnequipped)
- print("Done")
- wait(0.5)
- Instance.new("ForceField" ,game.Players.LocalPlayer.Character)
- kek = game.Players.LocalPlayer.Name
- local children = game.Workspace.Towers.Tower2:GetChildren()
- for _, child in pairs(children) do
- for _, child in pairs(child:GetChildren()) do
- table.insert(children, child)
- end
- if child:IsA("BasePart") then
- local function handleTouch(otherPart)
- local character = otherPart.Parent
- local humanoid = character:FindFirstChild("CarpetB1") or character:FindFirstChild("CarpetB2") or character:FindFirstChild("CarpetTail") or character:FindFirstChild("Handle")
- if humanoid then
- child.Anchored = false
- fire2 = Instance.new("Fire")
- fire2.Parent = child
- explo1 = Instance.new("Explosion")
- explo1.Parent = child
- explo1.BlastPressure = 10
- explo1.Position = child.Position
- end
- end
- child.Touched:connect(handleTouch)
- end
- end
- local children = game.Workspace.Towers.Tower1:GetChildren()
- for _, child in pairs(children) do
- for _, child in pairs(child:GetChildren()) do
- table.insert(children, child)
- end
- if child:IsA("BasePart") then
- local function handleTouch(otherPart)
- local character = otherPart.Parent
- local humanoid = character:FindFirstChild("CarpetB1") or character:FindFirstChild("CarpetB2") or character:FindFirstChild("CarpetTail") or character:FindFirstChild("Handle")
- if humanoid then
- child.Anchored = false
- fire1 = Instance.new("Fire")
- fire1.Parent = child
- explo2 = Instance.new("Explosion")
- explo2.Parent = child
- explo2.BlastPressure = 10
- explo2.Position = child.Position
- end
- end
- child.Touched:connect(handleTouch)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement