Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --made by youtube : Intensivelake39/discord: bad#5159/roblox : ttatatataat7777
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Script1 = Instance.new("Script")
- Script2 = Instance.new("Script")
- LocalScript3 = Instance.new("LocalScript")
- Animation4 = Instance.new("Animation")
- Color3Value5 = Instance.new("Color3Value")
- LocalScript6 = Instance.new("LocalScript")
- Part7 = Instance.new("Part")
- SpecialMesh8 = Instance.new("SpecialMesh")
- Sound9 = Instance.new("Sound")
- Sound10 = Instance.new("Sound")
- Tool0.Name = "MLG HYPERBIKE"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=212658181"
- Tool0.GripPos = Vector3.new(1.5, 2.20000005, -2)
- Script1.Parent = Tool0
- table.insert(cors,sandbox(Script1,function()
- --Made by Luckymaxer
- Tool = script.Parent
- Handle = Tool:WaitForChild("Handle")
- Players = game:GetService("Players")
- Debris = game:GetService("Debris")
- Assets = require(Tool:WaitForChild("Assets"))
- Data = Assets.Data
- ColorValue = Tool:WaitForChild("CurrentColor")
- BaseUrl = Assets.BaseUrl
- BasePart = Instance.new("Part")
- BasePart.Material = Enum.Material.Plastic
- BasePart.Shape = Enum.PartType.Block
- BasePart.TopSurface = Enum.SurfaceType.Smooth
- BasePart.BottomSurface = Enum.SurfaceType.Smooth
- BasePart.FormFactor = Enum.FormFactor.Custom
- BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
- BasePart.Anchored = false
- BasePart.CanCollide = true
- BasePart.Locked = true
- Colors = {
- {Texture = 256465742, Color = BrickColor.new("Institutional white")}, --Red
- {Texture = 256465742, Color = BrickColor.new("Lime green")}, --Orange
- {Texture = 256465742, Color = BrickColor.new("Bright red")}, --Green
- {Texture = 256465742, Color = BrickColor.new("Really black")}, --Blue
- {Texture = 256465742, Color = BrickColor.new("Crimson")}, --Light Blue
- {Texture = 256465742, Color = BrickColor.new("Bright orange")}, --Magenta
- }
- CurrentColor = 0
- CycleTick = 0
- CycleTime = 1
- Animations = {
- Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil}
- }
- Sounds = {
- Honk = Handle:WaitForChild("Honk"),
- Engine = Handle:WaitForChild("Running")
- }
- Controls = {
- Forward = {Key = "w", ByteKey = 17, Mode = false},
- Backward = {Key = "s", ByteKey = 18, Mode = false},
- Left = {Key = "a", ByteKey = 20, Mode = false},
- Right = {Key = "d", ByteKey = 19, Mode = false}
- }
- Rate = (1 / 60)
- Gravity = 196.20
- PoseOffset = CFrame.new(0, -2, 0.5) * CFrame.Angles(0, 0, 0) --The offset your character is from the center of the vehicle.
- SpeedBoost = {
- Allowed = false,
- Active = false,
- Enabled = true,
- Duration = 10,
- ReloadTime = 30
- }
- Special = {
- Allowed = false,
- Enabled = true,
- Active = false,
- Duration = 0,
- ReloadTime = 60
- }
- Speed = {
- Acceleration = {
- Normal = 150,
- Boost = 300
- },
- Deceleration = {
- Normal = 150,
- Boost = 300
- },
- MovementSpeed = {
- Normal = {Min = 150, Max = 300},
- Boost = {Min = 150, Max = 300}
- },
- TurnSpeed = {
- Speed = {Min = 5, Max = 5},
- TurnAlpha = 0.30,
- AlphaDampening = 0.2
- },
- }
- MaxSpeed = { --Maximum speed which the vehicle can move and turn at.
- Movement = Speed.MovementSpeed.Normal,
- Turn = Speed.TurnSpeed.Speed,
- Acceleration = Speed.Acceleration.Normal,
- Deceleration = Speed.Deceleration.Normal
- }
- CurrentSpeed = { --The speed which the vehicle is moving and turning at.
- Movement = 0,
- Turn = 0
- }
- Honk = {
- Honking = false,
- LastHonk = 0,
- ReloadTime = 1
- }
- Jump = {
- Jumping = false,
- LastJump = 0,
- ReloadTime = 1.9,
- JumpForce = 50
- }
- ToolEquipped = false
- ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
- ServerControl.Name = "ServerControl"
- ServerControl.Parent = Tool
- ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
- ClientControl.Name = "ClientControl"
- ClientControl.Parent = Tool
- Tool.Enabled = true
- function RayCast(Position, Direction, MaxDistance, IgnoreList)
- local IgnoreList = ((type(IgnoreList) == "table" and IgnoreList) or {IgnoreList})
- return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList)
- end
- function GetAllConnectedParts(Object)
- local Parts = {}
- local function GetConnectedParts(Object)
- for i, v in pairs(Object:GetConnectedParts()) do
- local Ignore = false
- for ii, vv in pairs(Parts) do
- if v == vv then
- Ignore = true
- end
- end
- if not Ignore then
- table.insert(Parts, v)
- GetConnectedParts(v)
- end
- end
- end
- GetConnectedParts(Object)
- return Parts
- end
- function EnableFirstPersonView()
- if not CheckIfAlive() or not ToolEquipped then
- return
- end
- local Limbs = {"Left Arm", "Right Arm"}
- for i, v in pairs(Limbs) do
- local Limb = Character:FindFirstChild(v)
- if Limb:IsA("BasePart") then
- Spawn(function()
- InvokeClient("SetLocalTransparencyModifier", {Object = Limb, Transparency = 0, AutoUpdate = false})
- end)
- end
- end
- end
- function ThrustUpdater()
- for i, v in pairs(CurrentSpeed) do
- CurrentSpeed[i] = 0
- end
- for i, v in pairs(Controls) do
- Controls[i].Mode = false
- end
- while ToolEquipped and Body and Body.Parent and CheckIfAlive() and RotationForce and RotationForce.Parent and ThrustForce and ThrustForce.Parent and TurnGyro and TurnGyro.Parent do
- RotationForce.angularvelocity = Vector3.new(0, CurrentSpeed.Turn, 0)
- if math.abs(CurrentSpeed.Turn) > Speed.TurnSpeed.AlphaDampening then
- CurrentSpeed.Turn = (CurrentSpeed.Turn - (Speed.TurnSpeed.AlphaDampening * (math.abs(CurrentSpeed.Turn) / CurrentSpeed.Turn)))
- else
- CurrentSpeed.Turn = 0
- end
- if not Controls.Forward.Mode or Controls.Backward.Mode then --Slow down if not controlling.
- CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.99)
- end
- local MySpeed = Vector3.new(Body.Velocity.X, 0, Body.Velocity.Z).magnitude
- local VelocityDifference = math.abs((MySpeed - (ThrustForce.velocity.magnitude)))
- if MySpeed > 3 and ThrustForce.velocity.magnitude > 3 and VelocityDifference > (0.7 * ThrustForce.velocity.magnitude) then
- CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.9)
- end
- if Controls.Forward.Mode then --Handle acceleration
- CurrentSpeed.Movement = math.min(MaxSpeed.Movement.Max, (CurrentSpeed.Movement + (MaxSpeed.Acceleration * Rate)))
- end
- if Controls.Backward.Mode then --Handle deceleration, if speed is more than 0, decrease quicker.
- CurrentSpeed.Movement = math.max(-MaxSpeed.Movement.Min, (CurrentSpeed.Movement - (MaxSpeed.Deceleration * ((CurrentSpeed.Movement > 0 and 2.8) or 1) * Rate)))
- end
- if Controls.Left.Mode then --Handle left turn speed
- CurrentSpeed.Turn = math.min(Speed.TurnSpeed.Speed.Max, (CurrentSpeed.Turn + (Speed.TurnSpeed.TurnAlpha)))
- end
- if Controls.Right.Mode then --Handle right turn speed
- CurrentSpeed.Turn = math.max(-Speed.TurnSpeed.Speed.Min, (CurrentSpeed.Turn - (Speed.TurnSpeed.TurnAlpha)))
- end
- local Direction = Torso.CFrame.lookVector
- Direction = Vector3.new(Direction.x, 0, Direction.z).unit
- local Velocity = (Direction * CurrentSpeed.Movement) --The thrust force which you move.
- ThrustForce.velocity = Vector3.new(Velocity.X, ThrustForce.velocity.Y, Velocity.Z)
- local LeanAmount = (-CurrentSpeed.Turn * (math.pi / 6) / 4) --Amount your character leans over.
- local XZAngle = math.atan2(Torso.CFrame.lookVector.z, 0, Torso.CFrame.lookVector.x) --Handle rotation
- TurnGyro.cframe = CFrame.Angles((LeanAmount * Direction.x), 0, (LeanAmount * Direction.z))
- --Wheel animation
- local DesiredAngle = (999999999 * (-CurrentSpeed.Movement / math.abs(CurrentSpeed.Movement)))
- local MaxVelocity = (CurrentSpeed.Movement / 250)
- for i, v in pairs({FrontMotor, BackMotor}) do
- if v and v.Parent then
- v.DesiredAngle = DesiredAngle
- v.MaxVelocity = MaxVelocity
- end
- end
- --Smoke exhaust from vehicle running.
- for i, v in pairs(ExhaustSmoke) do
- if v and v.Parent then
- v.Opacity = ((math.min(math.abs(CurrentSpeed.Movement), 10) / 10) * 0.5)
- end
- end
- --Engine running sound which pitch changes while in motion.
- Sounds.Engine.Pitch = (1 + (math.abs(CurrentSpeed.Movement / MaxSpeed.Movement.Max) * 1))
- if (tick() - CycleTick) >= CycleTime then
- CycleTick = tick()
- CurrentColor = (CurrentColor + 1)
- CurrentColor = ((CurrentColor > #Colors and 1) or CurrentColor)
- local ColorTable = Colors[CurrentColor]
- ColorValue.Value = ColorTable.Color.Color
- local Parts = {Body}
- for i, v in pairs(Body:GetChildren()) do
- if v:IsA("BasePart") then
- table.insert(Parts, v)
- end
- end
- for i, v in pairs(Parts) do
- if v ~= Body then
- v.BrickColor = ColorTable.Color
- end
- for ii, vv in pairs(v:GetChildren()) do
- if vv:IsA("FileMesh") then
- vv.TextureId = (BaseUrl .. ColorTable.Texture)
- elseif vv:IsA("Light") then
- vv.Color = ColorTable.Color.Color
- elseif vv:IsA("BasePart") then
- end
- end
- end
- end
- wait(Rate)
- end
- end
- function SpawnVehicle()
- Handle.Transparency = 1
- Spawn(function()
- InvokeClient("PlaySound", Sounds.Engine)
- InvokeClient("PlayAnimation", Animations.Hold)
- end)
- Humanoid.PlatformStand = true
- CurrentColor = math.random(1, #Colors)
- ColorValue.Value = Colors[CurrentColor].Color.Color
- local VehicleData = Assets.CreateVehicle()
- Body = VehicleData.Vehicle
- local ParticleTable = VehicleData.Tables
- FrontMotor = Body.FrontMotor
- BackMotor = Body.BackMotor
- ExhaustSmoke = ParticleTable.ExhaustSmoke
- Lights = ParticleTable.Lights
- Sparkles = ParticleTable.Sparkles
- if SpeedBoost.Active then
- for i, v in pairs(Sparkles) do
- if v and v.Parent then
- v.Enabled = true
- end
- end
- end
- local TorsoWeld = Instance.new("Weld")
- TorsoWeld.C0 = PoseOffset
- TorsoWeld.Part0 = Torso
- TorsoWeld.Part1 = Body
- TorsoWeld.Parent = Body
- Body.CanCollide = true
- RotationForce = Instance.new("BodyAngularVelocity")
- RotationForce.maxTorque = Vector3.new(0, math.huge, 0)
- RotationForce.angularvelocity = Vector3.new(0, 0, 0)
- RotationForce.Parent = Torso
- ThrustForce = Instance.new("BodyVelocity")
- ThrustForce.maxForce = Vector3.new(math.huge, 0, math.huge)
- ThrustForce.velocity = Vector3.new(0, 0, 0)
- ThrustForce.P = 100
- ThrustForce.Parent = Torso
- TurnGyro = Instance.new("BodyGyro")
- TurnGyro.maxTorque = Vector3.new(5000, 0, 5000)
- TurnGyro.P = 300
- TurnGyro.D = 100
- TurnGyro.Parent = Torso
- Body.Parent = Tool
- local RayHit, RayPos, RayNormal = RayCast(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2), {Character})
- if RayHit then
- Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
- end
- Spawn(ThrustUpdater)
- end
- function FreezePlayer()
- if CheckIfAlive() then
- local FreezePart = BasePart:Clone()
- FreezePart.Name = "FreezePart"
- FreezePart.Transparency = 1
- FreezePart.Anchored = true
- FreezePart.CanCollide = false
- local FreezeWeld = Instance.new("Weld")
- FreezeWeld.Part0 = Torso
- FreezeWeld.Part1 = FreezePart
- FreezeWeld.Parent = FreezePart
- Debris:AddItem(FreezePart, 0.125)
- FreezePart.Parent = Character
- Torso.Velocity = Vector3.new(0, -25, 0)
- Torso.RotVelocity = Vector3.new(0, 0, 0)
- end
- end
- function CleanUp()
- Handle.Velocity = Vector3.new(0, 0, 0)
- Handle.RotVelocity = Vector3.new(0, 0, 0)
- for i, v in pairs({}) do
- if v then
- v:disconnect()
- end
- end
- for i, v in pairs({Body, RotationForce, ThrustForce, TurnGyro}) do
- if v and v.Parent then
- v:Destroy()
- end
- end
- for i, v in pairs(Tool:GetChildren()) do
- if v:IsA("BasePart") and v ~= Handle then
- v:Destroy()
- end
- end
- end
- function CheckIfAlive()
- return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
- end
- function Equipped(Mouse)
- Character = Tool.Parent
- Player = Players:GetPlayerFromCharacter(Character)
- Humanoid = Character:FindFirstChild("Humanoid")
- Torso = Character:FindFirstChild("Torso")
- if not CheckIfAlive() then
- return
- end
- for i, v in pairs(Colors) do
- Spawn(function()
- InvokeClient("Preload", (BaseUrl .. v.Texture))
- end)
- end
- Spawn(CleanUp)
- Spawn(EnableFirstPersonView)
- Spawn(SpawnVehicle)
- ToolEquipped = true
- end
- function Unequipped()
- Spawn(CleanUp)
- Spawn(FreezePlayer)
- for i, v in pairs(Sounds) do
- v:Stop()
- Spawn(function()
- InvokeClient("StopSound", v)
- end)
- end
- if CheckIfAlive() then
- Humanoid.PlatformStand = false
- end
- Handle.Transparency = 0
- ToolEquipped = false
- end
- function OnServerInvoke(player, mode, value)
- if player == Player and ToolEquipped and value and CheckIfAlive() then
- if mode == "KeyPress" then
- local Down = value.Down
- local Key = value.Key
- local ByteKey = string.byte(Key)
- for i, v in pairs(Controls) do
- if Key == v.Key or ByteKey == v.ByteKey then
- Controls[i].Mode = Down
- end
- end
- if Key == " " and Down then --Jump controller
- if math.abs(tick() - Jump.LastJump) > Jump.ReloadTime and not Jump.Jumping and ThrustForce and ThrustForce.Parent then
- Jump.Jumping = true
- local Parts = GetAllConnectedParts(Body)
- local Mass = 0
- for i, v in pairs(Parts) do
- Mass = (Mass + v:GetMass())
- end
- ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, ((Mass * Gravity) * 100), ThrustForce.maxForce.Z)
- ThrustForce.velocity = (Vector3.new(0, 1, 0) * Jump.JumpForce) + Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
- wait(0.1)
- ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, 0, ThrustForce.maxForce.Z)
- ThrustForce.velocity = Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
- Jump.LastJump = tick()
- Jump.Jumping = false
- end
- elseif Key == "x" and Down then --Toggle light(s) on/off.
- for i, v in pairs(Lights) do
- if v and v.Parent then
- v.Enabled = not v.Enabled
- end
- end
- elseif Key == "h" and Down then --Play honk sound.
- local Sound = Sounds.Honk
- if (tick() - Honk.LastHonk) >= (Sound.TimeLength + Honk.ReloadTime) and not Honk.Honking then
- Honk.Honking = true
- local TempSound = Sound:Clone()
- Debris:AddItem(TempSound, Sound.TimeLength)
- TempSound.Parent = Body
- TempSound:Play()
- Honk.LastHonk = tick()
- Honk.Honking = false
- end
- elseif Key == "q" and Down then --Activate special.
- if not Special.Allowed or not Special.Enabled or Special.Active then
- return
- end
- Special.Enabled = false
- Special.Active = true
- wait(Special.Duration)
- Special.Active = false
- wait(Special.ReloadTime)
- Special.Enabled = true
- elseif ByteKey == 48 and Down then --Activate speed boost.
- if not SpeedBoost.Allowed or not SpeedBoost.Enabled or SpeedBoost.Active then
- return
- end
- SpeedBoost.Enabled = false
- SpeedBoost.Active = true
- for i, v in pairs(Sparkles) do
- if v and v.Parent then
- v.Enabled = true
- end
- end
- MaxSpeed.Acceleration = Speed.Acceleration.Boost
- MaxSpeed.Deceleration = Speed.Deceleration.Boost
- MaxSpeed.Movement = Speed.MovementSpeed.Boost
- wait(SpeedBoost.Duration)
- MaxSpeed.Acceleration = Speed.Acceleration.Normal
- MaxSpeed.Deceleration = Speed.Deceleration.Normal
- MaxSpeed.Movement = Speed.MovementSpeed.Normal
- for i, v in pairs(Sparkles) do
- if v and v.Parent then
- v.Enabled = false
- end
- end
- SpeedBoost.Active = false
- wait(SpeedBoost.ReloadTime)
- SpeedBoost.Enabled = true
- end
- end
- end
- end
- function InvokeClient(Mode, Value)
- local ClientReturn = nil
- pcall(function()
- ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
- end)
- return ClientReturn
- end
- Spawn(CleanUp)
- ServerControl.OnServerInvoke = OnServerInvoke
- Tool.Equipped:connect(Equipped)
- Tool.Unequipped:connect(Unequipped)
- end))
- Script2.Name = "TrailScript"
- Script2.Parent = Tool0
- table.insert(cors,sandbox(Script2,function()
- --Made by Luckymaxer
- Tool = script.Parent
- Handle = Tool:WaitForChild("Handle")
- Debris = game:GetService("Debris")
- CurrentColor = Tool:WaitForChild("CurrentColor")
- BasePart = Instance.new("Part")
- BasePart.Shape = Enum.PartType.Block
- BasePart.Material = Enum.Material.Plastic
- BasePart.TopSurface = Enum.SurfaceType.Smooth
- BasePart.BottomSurface = Enum.SurfaceType.Smooth
- BasePart.FormFactor = Enum.FormFactor.Custom
- BasePart.Anchored = false
- BasePart.CanCollide = true
- BasePart.Locked = true
- BaseTrailPart = BasePart:Clone()
- BaseTrailPart.Name = "LaserTrail"
- BaseTrailPart.Transparency = 0.2
- BaseTrailPart.Size = Vector3.new(0.2, 5, 3)
- BaseTrailPart.Material = Enum.Material.SmoothPlastic
- BaseTrailPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines
- BaseTrailPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
- BaseTrailPart.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
- BaseTrailPart.RightSurface = Enum.SurfaceType.SmoothNoOutlines
- BaseTrailPart.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
- BaseTrailPart.BackSurface = Enum.SurfaceType.SmoothNoOutlines
- BaseTrailPart.Anchored = true
- BaseTrailPart.CanCollide = false
- TrailLight = Instance.new("PointLight")
- TrailLight.Name = "Light"
- TrailLight.Brightness = 10
- TrailLight.Range = 8
- TrailLight.Shadows = false
- TrailLight.Enabled = true
- TrailLight.Parent = BaseTrailPart
- Rate = (1 / 60)
- function StartTrail(Source, Parent)
- local TrailParts = {}
- local SourceAlive = true
- local NumberOfParts = 60
- local LastPoint = (Source.CFrame * CFrame.new(0, 0, 4)).p
- Source.Changed:connect(function(Property)
- if Property == "Parent" and not Source.Parent then
- SourceAlive = false
- end
- end)
- while SourceAlive do
- local CurrentPoint = (Source.CFrame * CFrame.new(0, 0, 4)).p
- if Source.Velocity.magnitude > 20 then
- local TrailPart = BaseTrailPart:Clone()
- TrailPart.BrickColor = BrickColor.new(CurrentColor.Value)
- TrailPart.Light.Color = CurrentColor.Value
- TrailPart.Size = Vector3.new(TrailPart.Size.X, TrailPart.Size.Y, (CurrentPoint - LastPoint).magnitude)
- table.insert(TrailParts, TrailPart)
- TrailPart.Parent = Parent
- TrailPart.CFrame = CFrame.new(((CurrentPoint + LastPoint) * 0.5), LastPoint)
- if #TrailParts > NumberOfParts then
- local TrailPart = TrailParts[1]
- if TrailPart and TrailPart.Parent then
- TrailPart:Destroy()
- end
- table.remove(TrailParts, 1)
- end
- else
- local TrailPart = TrailParts[1]
- if TrailPart and TrailPart.Parent then
- TrailPart:Destroy()
- end
- table.remove(TrailParts, 1)
- end
- LastPoint = CurrentPoint
- wait(Rate)
- end
- for i, v in pairs(TrailParts) do
- if v and v.Parent then
- v:Destroy()
- end
- end
- end
- Tool.ChildAdded:connect(function(Child)
- if Child.Name == "Body" then
- Spawn(function()
- StartTrail(Child, Tool)
- end)
- end
- end)
- end))
- LocalScript3.Name = "MouseIcon"
- LocalScript3.Parent = Tool0
- table.insert(cors,sandbox(LocalScript3,function()
- --Made by Luckymaxer
- Mouse_Icon = "rbxasset://textures/GunCursor.png"
- Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
- Tool = script.Parent
- Mouse = nil
- function UpdateIcon()
- if Mouse then
- Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
- end
- end
- function OnEquipped(ToolMouse)
- Mouse = ToolMouse
- UpdateIcon()
- end
- function OnChanged(Property)
- if Property == "Enabled" then
- UpdateIcon()
- end
- end
- Tool.Equipped:connect(OnEquipped)
- Tool.Changed:connect(OnChanged)
- end))
- Animation4.Name = "Hold"
- Animation4.Parent = Tool0
- Animation4.AnimationId = "http://www.roblox.com/asset/?id=214738896"
- Color3Value5.Name = "CurrentColor"
- Color3Value5.Parent = Tool0
- Color3Value5.Value = Color3.new(0.666667, 0, 0.666667)
- LocalScript6.Parent = Tool0
- table.insert(cors,sandbox(LocalScript6,function()
- --Made by Luckymaxer
- Tool = script.Parent
- Handle = Tool:WaitForChild("Handle")
- Players = game:GetService("Players")
- RunService = game:GetService("RunService")
- ContentProvider = game:GetService("ContentProvider")
- Camera = game:GetService("Workspace").CurrentCamera
- Animations = {}
- LocalObjects = {}
- ServerControl = Tool:WaitForChild("ServerControl")
- ClientControl = Tool:WaitForChild("ClientControl")
- ToolEquipped = false
- function SetAnimation(mode, value)
- if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
- for i, v in pairs(Animations) do
- if v.Animation == value.Animation then
- v.AnimationTrack:Stop()
- table.remove(Animations, i)
- end
- end
- local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
- table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
- AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
- elseif mode == "StopAnimation" and value then
- for i, v in pairs(Animations) do
- if v.Animation == value.Animation then
- v.AnimationTrack:Stop()
- table.remove(Animations, i)
- end
- end
- end
- end
- function DisableJump(Boolean)
- if PreventJump then
- PreventJump:disconnect()
- end
- if Boolean then
- PreventJump = Humanoid.Changed:connect(function(Property)
- if Property == "Jump" then
- Humanoid.Jump = false
- end
- end)
- end
- end
- function CheckIfAlive()
- return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
- end
- function Equipped(Mouse)
- Character = Tool.Parent
- Player = Players:GetPlayerFromCharacter(Character)
- Humanoid = Character:FindFirstChild("Humanoid")
- ToolEquipped = true
- if not CheckIfAlive() then
- return
- end
- PlayerMouse = Player:GetMouse()
- Mouse.Button1Down:connect(function()
- InvokeServer("MouseClick", {Down = true})
- end)
- Mouse.Button1Up:connect(function()
- InvokeServer("MouseClick", {Down = false})
- end)
- Mouse.KeyDown:connect(function(Key)
- InvokeServer("KeyPress", {Key = Key, Down = true})
- end)
- Mouse.KeyUp:connect(function(Key)
- InvokeServer("KeyPress", {Key = Key, Down = false})
- end)
- Mouse.Move:connect(function()
- InvokeServer("MouseMove", {Position = Mouse.Hit.p, Target = Mouse.Target})
- end)
- Humanoid:ChangeState(Enum.HumanoidStateType.None)
- end
- function Unequipped()
- ToolEquipped = false
- LocalObjects = {}
- for i, v in pairs(Animations) do
- if v and v.AnimationTrack then
- v.AnimationTrack:Stop()
- end
- end
- for i, v in pairs({PreventJump, ObjectLocalTransparencyModifier}) do
- if v then
- v:disconnect()
- end
- end
- Humanoid:ChangeState(Enum.HumanoidStateType.Freefall) --Prevent the ability to fly by constantly equipping and unequipping the tool.
- Animations = {}
- end
- function InvokeServer(mode, value)
- pcall(function()
- local ServerReturn = ServerControl:InvokeServer(mode, value)
- return ServerReturn
- end)
- end
- function OnClientInvoke(mode, value)
- if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
- SetAnimation("PlayAnimation", value)
- elseif mode == "StopAnimation" and value then
- SetAnimation("StopAnimation", value)
- elseif mode == "PlaySound" and value then
- value:Play()
- elseif mode == "StopSound" and value then
- value:Stop()
- elseif mode == "MousePosition" then
- return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
- elseif mode == "DisableJump" then
- DisableJump(value)
- elseif mode == "Preload" and value then
- ContentProvider:Preload(value)
- elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
- pcall(function()
- local ObjectFound = false
- for i, v in pairs(LocalObjects) do
- if v == value then
- ObjectFound = true
- end
- end
- if not ObjectFound then
- table.insert(LocalObjects, value)
- if ObjectLocalTransparencyModifier then
- ObjectLocalTransparencyModifier:disconnect()
- end
- ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
- for i, v in pairs(LocalObjects) do
- if v.Object and v.Object.Parent then
- local CurrentTransparency = v.Object.LocalTransparencyModifier
- if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
- v.Object.LocalTransparencyModifier = v.Transparency
- end
- else
- table.remove(LocalObjects, i)
- end
- end
- end)
- end
- end)
- end
- end
- ClientControl.OnClientInvoke = OnClientInvoke
- Tool.Equipped:connect(Equipped)
- Tool.Unequipped:connect(Unequipped)
- end))
- Part7.Name = "Handle"
- Part7.Parent = Tool0
- Part7.Locked = true
- Part7.Elasticity = 0
- Part7.FormFactor = Enum.FormFactor.Custom
- Part7.Friction = 0
- Part7.Size = Vector3.new(0.200000003, 3.625, 9)
- Part7.CFrame = CFrame.new(-24, 1.8125, -7, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part7.BottomSurface = Enum.SurfaceType.Smooth
- Part7.TopSurface = Enum.SurfaceType.Smooth
- Part7.Position = Vector3.new(-24, 1.8125, -7)
- SpecialMesh8.Parent = Part7
- SpecialMesh8.MeshId = "http://www.roblox.com/asset/?id=204410623"
- SpecialMesh8.Scale = Vector3.new(1.25, 1.25, 1.25)
- SpecialMesh8.TextureId = "rbxassetid://256465742"
- SpecialMesh8.MeshType = Enum.MeshType.FileMesh
- SpecialMesh8.Scale = Vector3.new(1.25, 1.25, 1.25)
- Sound9.Name = "Running"
- Sound9.Parent = Part7
- Sound9.Pitch = 1.7471721172333
- Sound9.SoundId = "http://www.roblox.com/asset/?id=130091914"
- Sound9.Looped = true
- Sound10.Name = "Honk"
- Sound10.Parent = Part7
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Add Comment
Please, Sign In to add comment