Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script by JamzCodin
- cs = game:GetService("CollectionService")
- game:GetService("RunService").Heartbeat:Connect(function()
- local windintensity = 0
- local direction = Vector3.new(0,0,0)
- -- Wind Effects
- for i, v in pairs(cs:GetTagged("WindPart")) do
- if v:IsA("BasePart") and v:FindFirstChild("Direction") and v:FindFirstChild("Intensity") then
- windintensity = v:FindFirstChild("Intensity").Value
- direction = v:FindFirstChild("Direction").CFrame.LookVector
- local endregion = Vector3.new(v.Position.X + v.Size.X * 0.5, v.Position.Y + v.Size.Y * 0.5, v.Position.Z + v.Size.Z * 0.5)
- local startregion = Vector3.new(v.Position.X - v.Size.X * 0.5, v.Position.Y - v.Size.Y * 0.5, v.Position.Z - v.Size.Z * 0.5)
- local region = Region3.new(startregion, endregion)
- for i, x in pairs(game.Workspace:FindPartsInRegion3(region)) do
- if x.Parent:FindFirstChild("Humanoid") and x.Parent:FindFirstChild("HumanoidRootPart") then
- local addvelocity = direction * windintensity
- local multiplier = math.abs(x.Parent:FindFirstChild("HumanoidRootPart").Velocity.magnitude)
- if multiplier > 1 then
- multiplier = 1
- end
- if multiplier < 0.5 then
- multiplier = 0.5
- end
- addvelocity = addvelocity * multiplier
- x.Parent:FindFirstChild("HumanoidRootPart").Velocity = x.Parent:FindFirstChild("HumanoidRootPart").Velocity + addvelocity
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment