Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RS = game:GetService("ReplicatedStorage")
- local RunService = game:GetService("RunService")
- local Players = game:GetService("Players")
- local RegionSize = Vector3.new(80, 22, 104)
- local Duration,Cooldown = 3,2
- local RegionTable, V1 = {},{}
- local Debounce, EffectTable = {}, {}
- local Debonce2 = false
- local plr
- local function ChangeSpeed(Character,Walk,Jump,IsAnc)
- Character.Humanoid.WalkSpeed = Walk or 16
- Character.Humanoid.JumpPower = Jump or 50
- Character.HumanoidRootPart.Anchored = IsAnc or false
- end
- local function OnPlayerAdded(Player)
- Player.CharacterAdded:Connect(function(Character)
- local Spirit = Instance.new("NumberValue", Character)
- Spirit.Value = .5
- Spirit.Name = "Spirit"
- end)
- end
- local function SpirtRemote(Player)
- plr = Player
- if Debounce[plr] and Debonce2 then return else print(Debounce[plr], Debonce2) end
- local Reg1 = (Player.Character.HumanoidRootPart.CFrame).p - (RegionSize / 2)
- local Reg2 = (Player.Character.HumanoidRootPart.CFrame).p + (RegionSize / 2)
- V1[Player] = Region3.new(Reg1,Reg2)
- Debounce[Player] = true
- end
- local function SetPlayerWithMove()
- if not Debounce[plr] then return end
- local Character = plr.Character
- local CreateRegion = workspace:FindPartsInRegion3(V1[plr],Character,math.huge)
- for Index, Value in pairs(CreateRegion) do
- if Value.Parent:FindFirstChild("Humanoid") then
- local SpiritNum = Character.Spirit.Value
- local CharInRegion = Value.Parent
- if RegionTable[CharInRegion] == CharInRegion then
- if RegionTable[CharInRegion].Humanoid:GetAttribute("DoneEffects") then
- RegionTable[CharInRegion].Humanoid:TakeDamage(SpiritNum/100000)
- end
- else
- RegionTable[CharInRegion] = CharInRegion
- RegionTable[CharInRegion].Humanoid:SetAttribute("DoneEffects",false)
- end
- end
- end
- for Index,v in pairs(RegionTable) do
- if v.Humanoid:GetAttribute("DoneEffects") then return end
- if Debonce2 then return end
- if v == Character then
- RegionTable[Index] = nil
- continue
- end
- if v.Spirit.Value > Character.Spirit.Value then continue end
- local Humanoid = v.Humanoid
- local Effects = game.ReplicatedStorage.Effects:Clone()
- local NewAnimation = Instance.new("Animation");
- NewAnimation.AnimationId = "rbxassetid://7277996242"
- local KneelDown = Humanoid:LoadAnimation(NewAnimation)
- ChangeSpeed(v,0,0,true)
- for _,Emit in pairs(Effects:GetChildren()) do
- if Emit:IsA("ParticleEmitter") then
- Emit.Parent = v.Head
- EffectTable[#EffectTable + 1] = Emit
- elseif Emit:IsA("Sky") and game.Players:GetPlayerFromCharacter(v) then
- RS.Events.Pressure:FireClient(game.Players:GetPlayerFromCharacter(v),Duration, plr)
- end
- end
- EffectTable[#EffectTable + 1] = KneelDown
- EffectTable[#EffectTable]:Play()
- v.Humanoid:SetAttribute("DoneEffects", true)
- end
- task.delay(Duration, function()
- if Debonce2 then return end
- Debonce2 = true
- for Index,Key in pairs(EffectTable) do
- if EffectTable[Index]:IsA("AnimationTrack") then EffectTable[Index]:Stop() end
- EffectTable[Index]:Destroy()
- EffectTable[Index] = nil
- end
- for i,v in pairs(RegionTable) do
- v.Humanoid:SetAttribute("DoneEffects", nil)
- ChangeSpeed(v)
- RegionTable[i] = nil
- end
- task.wait(Cooldown)
- Debounce[plr] = nil
- Debonce2 = false
- end)
- end
- Players.PlayerAdded:Connect(OnPlayerAdded)
- RS.Events.Pressure.OnServerEvent:Connect(SpirtRemote)
- RunService.Heartbeat:Connect(SetPlayerWithMove)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement