Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- 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"))
- LocalScript0 = Instance.new("LocalScript")
- Animation1 = Instance.new("Animation")
- ParticleEmitter2 = Instance.new("ParticleEmitter")
- Animation3 = Instance.new("Animation")
- LocalScript0.Name = "MultipleJump"
- LocalScript0.Parent = mas
- table.insert(cors,sandbox(LocalScript0,function()
- -- put in starter character scripts
- local MAX_JUMPS = 2;
- local MAX_DIVES = 1;
- local TIME_BETWEEN_JUMPS = 0.1;
- local hrp = script.Parent:WaitForChild("HumanoidRootPart");
- local head = script.Parent:WaitForChild("Head");
- local humanoid = script.Parent:WaitForChild("Humanoid");
- local particle = script:WaitForChild("Particle");
- particle.Parent = nil;
- local anim;
- if (humanoid.RigType == Enum.HumanoidRigType.R15) then
- anim = humanoid:LoadAnimation(script:WaitForChild("Roll_R15"));
- else
- anim = humanoid:LoadAnimation(script:WaitForChild("Roll_R6"));
- end
- local canJump = true;
- local jumpCount = 0;
- local canDive = true;
- local diveCount = 0;
- local totalDives = 0;
- local function createParticle(cf, t)
- local part = Instance.new("Part");
- part.Size = Vector3.new(4, 4, 4)
- part.Anchored = true;
- part.CanCollide = false;
- part.Transparency = 1;
- part.CFrame = cf;
- part.Parent = game.Workspace;
- local clone = particle:Clone();
- clone.Enabled = true;
- clone.Parent = part;
- local life = clone.Lifetime;
- for i = 0, 1.1, 0.1 do
- clone.Lifetime = NumberRange.new((1-i)*life.Min, (1-i)*life.Max + 0.1);
- wait(t*0.1);
- end
- game:GetService("Debris"):AddItem(part, t);
- end
- local function onStateChange(old, new)
- if (new == Enum.HumanoidStateType.Landed or new == Enum.HumanoidStateType.Swimming or new == Enum.HumanoidStateType.Running or new == Enum.HumanoidStateType.RunningNoPhysics) then
- canDive = true;
- canJump = true;
- jumpCount = 0;
- diveCount = 0;
- anim:Stop();
- elseif (new == Enum.HumanoidStateType.Freefall or new == Enum.HumanoidStateType.Flying) then
- wait(TIME_BETWEEN_JUMPS)
- canJump = true;
- canDive = true;
- end
- end
- local function onJumpRequest()
- if (not humanoid or humanoid:GetState() == Enum.HumanoidStateType.Dead) then
- return;
- end
- if (canJump and jumpCount < MAX_JUMPS) then
- canJump = false;
- jumpCount = jumpCount + 1;
- humanoid:ChangeState(Enum.HumanoidStateType.Jumping);
- if (jumpCount > 1) then
- if (jumpCount % 2 == 0 or humanoid:GetState() == Enum.HumanoidStateType.Flying) then
- anim:Play(nil, nil, 2.5);
- end
- local z = hrp.CFrame:vectorToObjectSpace(hrp.Velocity).z;
- createParticle(hrp.CFrame * CFrame.new(0, -1, 0), .3);
- end
- end
- end
- local function onInput(input, process)
- if (process or not humanoid or humanoid:GetState() == Enum.HumanoidStateType.Dead) then
- return;
- end
- if (input.KeyCode == Enum.KeyCode.LeftShift and humanoid:GetState() == Enum.HumanoidStateType.Freefall and canDive and diveCount < MAX_DIVES) then
- canDive = false;
- diveCount = diveCount + 1;
- totalDives = totalDives + 1;
- anim:Stop();
- humanoid:ChangeState(Enum.HumanoidStateType.Flying);
- hrp.Velocity = hrp.CFrame:vectorToWorldSpace(Vector3.new(0, humanoid.JumpPower, -humanoid.WalkSpeed*3));
- hrp.RotVelocity = hrp.CFrame:vectorToWorldSpace(Vector3.new(-math.rad(135), 0, 0));
- createParticle(hrp.CFrame * CFrame.new(0, -1, -3), .3);
- local currentDive = totalDives;
- wait(0.5);
- if (currentDive == totalDives) then
- hrp.RotVelocity = hrp.CFrame:vectorToWorldSpace(Vector3.new(0, 0, 0));
- end
- end
- end
- local function onTouched(touchingPart, humanoidPart)
- if (humanoid:GetState() == Enum.HumanoidStateType.Flying and touchingPart.CanCollide) then
- local ray = Ray.new(humanoidPart.Position, -humanoidPart.Velocity * 10);
- local hit, pos, normal, material = game.Workspace:FindPartOnRayWithWhitelist(ray, {touchingPart});
- if (material ~= Enum.Material.Water and material ~= Enum.Material.Air and normal:Dot(Vector3.new(0, 1, 0)) <= 0.5) then
- hrp.Velocity = (normal + Vector3.new(0, 1, 0)) * 30;
- anim:Play(nil, nil, 2.5);
- end
- humanoid:ChangeState(Enum.HumanoidStateType.Freefall);
- end
- end
- if (MAX_DIVES > 0) then
- humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false);
- humanoid.Touched:Connect(onTouched);
- game:GetService("UserInputService").InputBegan:Connect(onInput);
- end
- humanoid.StateChanged:Connect(onStateChange);
- game:GetService("UserInputService").JumpRequest:Connect(onJumpRequest);
- end))
- Animation1.Name = "Roll_R15"
- Animation1.Parent = LocalScript0
- Animation1.AnimationId = "rbxassetid://2167121830"
- ParticleEmitter2.Name = "Particle"
- ParticleEmitter2.Parent = LocalScript0
- ParticleEmitter2.Rotation = NumberRange.new(-360, 360)
- ParticleEmitter2.Color = ColorSequence.new(Color3.new(0.368627, 0.368627, 0.368627),Color3.new(1, 1, 1))
- ParticleEmitter2.Enabled = false
- ParticleEmitter2.LightEmission = 0.5
- ParticleEmitter2.Texture = "http://www.roblox.com/asset/?id=275871881"
- ParticleEmitter2.Transparency = NumberSequence.new(1,0,0,1)
- ParticleEmitter2.ZOffset = 2
- ParticleEmitter2.Size = NumberSequence.new(1.6875,0.25)
- ParticleEmitter2.Lifetime = NumberRange.new(0.5, 1.2000000476837)
- ParticleEmitter2.Rate = 250
- ParticleEmitter2.RotSpeed = NumberRange.new(10, 100)
- ParticleEmitter2.SpreadAngle = Vector2.new(45, 45)
- ParticleEmitter2.VelocitySpread = 45
- Animation3.Name = "Roll_R6"
- Animation3.Parent = LocalScript0
- Animation3.AnimationId = "rbxassetid://02535928272"
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Character
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement