Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tel = Instance.new("Tool",owner.Backpack)
- jendle = Instance.new("Part",tel)
- jendle.Name = "Handle"
- --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"))
- Script0 = Instance.new("Script")
- ModuleScript1 = Instance.new("ModuleScript")
- ModuleScript2 = Instance.new("ModuleScript")
- Script0.Name = "GunAnimation"
- Script0.Parent = mas
- table.insert(cors,sandbox(Script0,function()
- --Rescripted by Luckymaxer
- Tool = script.Parent
- Handle = Tool:WaitForChild("Handle")
- Players = game:GetService("Players")
- Debris = game:GetService("Debris")
- RunService = game:GetService("RunService")
- RbxUtility = LoadLibrary("RbxUtility")
- Create = RbxUtility.Create
- BaseUrl = "http://www.roblox.com/asset/?id="
- CF = CFrame.new
- An = CFrame.Angles
- V3 = Vector3.new
- BasePart = Create("Part"){
- Material = Enum.Material.Plastic,
- FormFactor = Enum.FormFactor.Custom,
- TopSurface = Enum.SurfaceType.Smooth,
- BottomSurface = Enum.SurfaceType.Smooth,
- Size = V3(0.2, 0.2, 0.2),
- CanCollide = true,
- Locked = true,
- }
- Settings = {
- Damage = 10,
- EquipTime = 0.4,
- IdleSpeed = 5,
- AttackSpeed = 0.65,
- }
- StabDamage = 110
- Sounds = {
- Equip = {
- Handle:WaitForChild("Equip"),
- },
- Swing = {
- Handle:WaitForChild("Swing1"),
- Handle:WaitForChild("Swing2"),
- Handle:WaitForChild("Swing3"),
- Handle:WaitForChild("Swing4"),
- },
- Hit = {
- Handle:WaitForChild("Hit1"),
- Handle:WaitForChild("Hit2"),
- Handle:WaitForChild("Hit3"),
- },
- Death = {
- Handle:WaitForChild("Death1"),
- Handle:WaitForChild("Death2"),
- Handle:WaitForChild("Death3"),
- },
- }
- Configuration = require(script:WaitForChild("Configuration"))
- Functions = require(script:WaitForChild("Functions"))
- Animations = Configuration.Animations
- BaseWeapon = Handle:Clone()
- BaseWeapon.Name = "FakeHandle"
- BaseWeapon.Size = V3(0.2, 0.2, 0.2)
- BaseWeapon.CanCollide = false
- ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
- Name = "ServerControl",
- Parent = Tool,
- })
- ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
- Name = "ClientControl",
- Parent = Tool,
- })
- ToolEquipped = false
- Handle.Transparency = 0
- Tool.Enabled = true
- for i, v in pairs(Tool:GetChildren()) do
- if v:IsA("BasePart") and v ~= Handle then
- v:Destroy()
- end
- end
- TargetPosition = V3(0, 0, 0)
- function PlaySound(nm, dl)
- Spawn(function()
- local CurrentlyEquipped = true
- ToolUnequipped = Tool.Unequipped:connect(function()
- CurrentlyEquipped = false
- end)
- if dl then
- wait(dl)
- end
- if ToolUnequipped then
- ToolUnequipped:disconnect()
- end
- if not CurrentlyEquipped then
- return
- end
- local PossibleSounds = Sounds[nm]
- local Sound = PossibleSounds[math.random(1, #PossibleSounds)]
- Sound:Play()
- end)
- end
- function Slash(del)
- Spawn(function()
- local Hits = {}
- local Start = tick()
- local function PartTouched(Hit)
- if not Hit or not Hit.Parent then
- return
- end
- local character = Hit.Parent
- if Functions.CheckTableForInstance(Hits, character) then
- return
- end
- local player = Players:GetPlayerFromCharacter(character)
- if player and (player == Player or Functions.IsTeamMate(Player, player)) then
- return
- end
- local humanoid = character:FindFirstChild("Humanoid")
- if not humanoid or humanoid.Health == 0 then
- return
- end
- PlaySound("Hit", nil)
- local Damage = StabDamage
- table.insert(Hits, Hit)
- Functions.UntagHumanoid(humanoid)
- Functions.TagHumanoid(humanoid, Player)
- humanoid:TakeDamage(Damage)
- if humanoid.Health <= Damage then
- PlaySound("Death", nil)
- end
- end
- if WeaponHit then
- WeaponHit:disconnect()
- end
- WeaponHit = Weapon.Touched:connect(PartTouched)
- while (tick() - Start) <= Settings.AttackSpeed and ToolEquipped do
- wait()
- end
- if WeaponHit then
- WeaponHit:disconnect()
- end
- end)
- end
- function Animate(tp, st)
- AnimType = tp
- AnimState = st
- end
- function StartAnimation()
- OriginalJoints = {Neck = Torso:FindFirstChild("Neck"), LeftShoulder = Torso:FindFirstChild("Left Shoulder"), RightShoulder = Torso:FindFirstChild("Right Shoulder")}
- for i, v in pairs(OriginalJoints) do
- if v then
- local Joint = {Joint = v, Properties = {Part0 = v.Part0, Part1 = v.Part1, C0 = v.C0, C1 = v.C1}}
- OriginalJoints[i] = Joint
- end
- end
- local Joints = {
- LeftWeld = {Name = "LeftWeld", Part0 = Torso, Part1 = LeftArm, C0 = CF(-1.5, 0, 0)},
- RightWeld = {Name = "RightWeld", Part0 = Torso, Part1 = RightArm, C0 = CF(1.5, 0, 0)},
- HeadWeld = {Name = "Head", Part0 = Torso, Part1 = Head, C0 = CF(0, 1.5, 0)},
- }
- for i, v in pairs(OriginalJoints) do
- if v then
- v.Joint.Part1 = nil
- end
- end
- Welds = {}
- for i, v in pairs(Joints) do
- local Joint = Create("Snap"){
- Name = v.Name,
- Part0 = v.Part0,
- Part1 = v.Part1,
- C0 = v.C0,
- C1 = CF(0, 0, 0),
- Parent = Torso,
- }
- Welds[i] = Joint
- end
- end
- function EndAnimation()
- for i, v in pairs(Welds) do
- if v and v.Parent then
- v.Part0 = nil
- v.Part1 = nil
- v:Destroy()
- end
- end
- for i, v in pairs(OriginalJoints) do
- for ii, vv in pairs(v.Properties) do
- pcall(function()
- v.Joint[ii] = vv
- end)
- end
- end
- if AnimConnection then
- AnimConnection:disconnect()
- end
- for i, v in pairs(Tool:GetChildren()) do
- if v:IsA("BasePart") and v ~= Handle then
- v:Destroy()
- end
- end
- OriginalJoints = {}
- Welds = {}
- Weapon:Destroy()
- end
- function ManageAnimation()
- LastTick = tick()
- AnimEquip = 1
- LastAction = tick()
- IdleRand = math.random(4, 7)
- IdlePerform = 0
- IdleType = 1
- AttackPerform = 0
- AttackType = 1
- Animate("Equip", 0)
- PlaySound("Equip", 0.1)
- if AnimConnection then
- AnimConnection:disconnect()
- end
- AnimConnection = RunService.Stepped:connect(function()
- local Delta = (tick() - LastTick)
- LastTick = tick()
- if AnimEquip > 0 then
- AnimEquip = math.max(0, (AnimEquip - (Delta / Settings.EquipTime)))
- Animate("Equip", (1 - AnimEquip))
- elseif (tick() - AttackPerform) <= Settings.AttackSpeed then
- Animate(("Attack" .. AttackType), ((tick() - AttackPerform) / Settings.AttackSpeed))
- IdlePerform = 0
- elseif (tick() - IdlePerform) <= Settings.IdleSpeed then
- Animate(("Idle" .. IdleType), ((tick() - IdlePerform) / Settings.IdleSpeed))
- else
- Animate("Default", 0)
- end
- if (tick() - LastAction) >= IdleRand then
- IdleRand = math.random(12, 20)
- LastAction = tick()
- IdlePerform = tick()
- IdleType = math.random(1, 2)
- end
- end)
- end
- function RunAnimation()
- Weapon = BaseWeapon:Clone()
- Weapon.Parent = Tool
- local WepWeld = Create("Snap"){
- Part0 = RightArm,
- Part1 = Weapon,
- C0 = CF(0, 0, 0),
- Parent = Weapon,
- }
- local AHorse = Character:findFirstChild("HorseHead")
- local HorseDisPlace = {0, 0}
- local HorseCF = An(0.0001, 0.0001, 0)
- if AHorse then
- Spawn(function()
- while true do
- local rndwait = ((math.random(100, 1000) / 1000) * 4)
- wait(rndwait)
- local Oldd = {HorseDisPlace[1], HorseDisPlace[2]}
- local Disp2 = {math.random(-60, 60), math.random(0, 25)}
- local ld = 0
- while ld ~= 1 do
- local st = tick()
- wait()
- ld = math.min(1, ld + ((tick() - st) * 4))
- local Eff = Functions.EaseIn(ld)
- local x = (Oldd[1] - ((Oldd[1] - Disp2[1]) * Eff))
- local y = (Oldd[2] - ((Oldd[2] - Disp2[2]) * Eff))
- HorseDisPlace = {x, y}
- HorseCF = An(math.rad(y), math.rad(x) , 0)
- end
- end
- end)
- end
- local LastVa = 0
- local LastVa2 = 0
- local ViewVelocity = {0, 0}
- Spawn(function()
- local LastTime = tick()
- while Welds.LeftWeld and Welds.LeftWeld.Parent and CheckIfAlive() and ToolEquipped do
- local Delta = (tick() - LastTime)
- LastTime = tick()
- local BreatheAmp = 2
- local BreatheFreq = 0.8
- local Breathe = (math.sin(math.rad(tick() * 90 * BreatheFreq)) * BreatheAmp)
- local pDistance = (Head.Position - TargetPosition).Magnitude
- pDistance = ((pDistance == 0 and 0.0001) or pDistance)
- local pHeight = (TargetPosition.Y - Head.Position.Y)
- local ViewAngle = ((pHeight ~= 0 and math.deg(math.asin(math.abs(pHeight) / pDistance)) * (math.abs(pHeight) / pHeight)) or 0)
- local Anmtp = AnimType
- Anmtp = (((Anmtp and not Animations[Anmtp]) and "Default") or (not Anmtp and "Default") or Anmtp)
- local Anmst = (AnimState or 0)
- local CurrAnim = Configuration.PlayAnimation(Anmtp, Anmst)
- local ChestCF = (CF(0, 0.5, 0) * An(math.rad(math.max(-Configuration.RotAmplitudeChest, math.min(Configuration.RotAmplitudeChest, ViewAngle)) + 90 + Breathe), 0, 0))
- Welds.LeftWeld.C1 = (ChestCF * CurrAnim[1] * CF(0, -0.5, 0)):inverse()
- Welds.RightWeld.C1 = (ChestCF * CurrAnim[2] * CF(0, -0.5, 0)):inverse()
- WepWeld.C1 = (CurrAnim[3] * CF(0, 0.0125,0) * An(90, 0, 0)):inverse()
- if Configuration.AnimHead then
- Welds.HeadWeld.C1 = (CF(0, 0, 0) * An(math.rad(math.max(-Configuration.RotAmplitudeHead, math.min(Configuration.RotAmplitudeHead, ViewAngle))), 0, 0) * HorseCF):inverse()
- else
- Welds.HeadWeld.C1 = (CF(0, 0, 0)):inverse()
- end
- Spawn(function()
- InvokeClient("CurrentAnimation", {Animations = CurrAnim})
- end)
- wait()
- end
- end)
- end
- function CheckIfAlive()
- return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Head and Head.Parent and Torso and Torso.Parent and LeftArm and LeftArm.Parent and RightArm and RightArm.Parent) and true) or false)
- end
- function Activated()
- if AnimEquip > 0 or (tick() - AttackPerform) <= Settings.AttackSpeed then
- return
- end
- AttackPerform = tick()
- LastAction = tick()
- AttackType = math.random(1, 3)
- IdlePerform = 0
- PlaySound("Swing", 0.15)
- Slash(0.17)
- end
- function Equipped()
- Character = Tool.Parent
- Humanoid = Character:FindFirstChild("Humanoid")
- Head = Character:FindFirstChild("Head")
- Torso = Character:FindFirstChild("Torso")
- LeftArm = Character:FindFirstChild("Left Arm")
- RightArm = Character:FindFirstChild("Right Arm")
- Player = Players:GetPlayerFromCharacter(Character)
- if not CheckIfAlive() then
- return
- end
- Spawn(function()
- Handle.Transparency = 1
- Humanoid.WalkSpeed = 19
- for i, v in pairs({LeftArm, RightArm}) do
- if v then
- Spawn(function()
- InvokeClient("SetLocalTransparencyModifier", {Object = v, Transparency = 0, AutoUpdate = false})
- end)
- end
- end
- StartAnimation()
- ManageAnimation()
- RunAnimation()
- end)
- ToolEquipped = true
- end
- function Unequipped()
- Handle.Transparency = 0
- if CheckIfAlive() then
- Humanoid.WalkSpeed = 16
- end
- EndAnimation()
- ToolEquipped = false
- end
- function OnServerInvoke(player, mode, value)
- if player ~= Player or not ToolEquipped or not mode or not value or not CheckIfAlive() then
- return
- end
- if mode == "SetTarget" then
- local TargetPos = value.TargetPosition
- if not TargetPos then
- return
- end
- TargetPosition = TargetPos
- end
- end
- function InvokeClient(Mode, Value)
- local ClientReturn = nil
- pcall(function()
- ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
- end)
- return ClientReturn
- end
- ServerControl.OnServerInvoke = OnServerInvoke
- Tool.Activated:connect(Activated)
- Tool.Equipped:connect(Equipped)
- Tool.Unequipped:connect(Unequipped)
- end))
- Script0.Disabled = true
- ModuleScript1.Name = "Configuration"
- ModuleScript1.Parent = Script0
- table.insert(cors,sandbox(ModuleScript1,function()
- --Rescripted by Luckymaxer
- CF = CFrame.new
- An = CFrame.Angles
- Configuration = {
- AnimType = "Default",
- AnimState = 0,
- AnimHead = false,
- RotAmplitudeHead = 20,
- RotAmplitudeChest = 15,
- Animations = {
- Default = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Equip = {
- {{}, 0, CFrame.new(0, 0, 0) * CFrame.Angles(-1.571, 0, 0), CFrame.new(0, 0, 0) * CFrame.Angles(-1.571, 0, 0), CFrame.new(0, -1.3, -0.5) * CFrame.Angles(-2.618, 0, 0)},
- {{0.8, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.024, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- },
- Idle1 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.3, 2}, 0, CFrame.new(0.8, -0.301, 0.2) * CFrame.Angles(-0.05, 0, 0.872), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.523, 1.221, -0.699), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 1.221, 0)},
- {{0.55, 2}, 0, CFrame.new(0.2, -0.5, 0.2) * CFrame.Angles(-0.04, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0, 1.221, -0.175), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.746, 1.221, 0.174)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- },
- Idle2 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.3, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.024, 0, 0.872), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, -0.175, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0.523, 0)},
- {{0.3, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(0.049, 0, 0.523), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.174, 0.698, -0.524), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, -1.222, 0)},
- {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(0.01, 0, 0.349), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.139, 0.663, -0.489), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, -1.222, 0)},
- {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Attack1 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.048, 0, 0.349), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.872, 0.349, 0.087), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.101, 0.1) * CFrame.Angles(-1.571, 0, -0.35), CFrame.new(-0.301, -0.301, 0.1) * CFrame.Angles(-1.048, -0.175, -0.524), CFrame.new(0, -1.201, -0.801) * CFrame.Angles(-2.095, 0, 0)},
- {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Attack2 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.099, 0, 0.872), CFrame.new(-0.401, 0.3, 0.1) * CFrame.Angles(1.919, 2.443, -1.222), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.048, 0, -0.524), CFrame.new(-0.5, -0.201, -0.101) * CFrame.Angles(0.523, 1.396, -0.873), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Attack3 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.397, 0, 0.174), CFrame.new(-0.401, -0.201, 0) * CFrame.Angles(1.396, 0.698, -1.571), CFrame.new(0, -1.3, -0.401) * CFrame.Angles(-2.444, 0, 0)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.397, 0, 0.174), CFrame.new(-0.401, 0.1, 0) * CFrame.Angles(0.349, 2.094, -0.524), CFrame.new(0, -1.3, 0.1) * CFrame.Angles(-3.84, 0, 0)},
- {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.073, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)} --Psst. Create a dummy, try setting position and angles of limbs and the weapon, save CFrame data to code. Easy? Yes. When making a single knife tool, it was all you needed.
- }
- }
- }
- function Configuration.EaseIn(x)
- return math.sin(math.rad(x * 90))
- end
- function Configuration.CFrameTrans(GetCFrame1, GetCFrame2, GetNumber)
- local Diff2 = (GetCFrame2.p - GetCFrame1.p)
- local GetCFrame1s = (GetCFrame1 - GetCFrame1.p)
- local GetCFrame2 = (GetCFrame2 - GetCFrame2.p)
- local Diff = (GetCFrame1s:inverse() * GetCFrame2)
- local x1, y1, z1 = Diff:toEulerAnglesXYZ()
- return (GetCFrame1 + (Diff2 * GetNumber)) * An(x1 * GetNumber, y1 * GetNumber, z1 * GetNumber)
- end
- function Configuration.TransEff(x, type)
- local Types = {
- [1] = x,
- [2] = (x * x * (3 - 2 * x)),
- [3] = math.sin(math.rad(x * 90)),
- [4] = (1 - math.sin(math.rad((1 - x) * 90))),
- }
- return (Types[type] or nil)
- end
- function Configuration.NumTrans(n1, n2, x)
- return (n1 + ((n2 - n1) * x))
- end
- function Configuration.PlayAnimation(animname, tm) --return {Left, Right, Wep, Trans}
- local tm = math.min(1, math.max(0, tm))
- local Animd = Configuration.Animations[animname]
- if #Animd == 1 then
- return {Animd[1][3], Animd[1][4], Animd[1][5], Animd[1][2]}
- else
- local TransFrom = 1
- local TransTo = 1
- local TmLeft = tm
- for i = 2, #Animd do
- TmLeft = (TmLeft - Animd[i][1][1])
- if TmLeft <= 0 then
- TransFrom = (i - 1)
- TransTo = i
- break
- end
- end
- local TransAmm = Configuration.TransEff((Animd[TransTo][1][1] + TmLeft) / Animd[TransTo][1][1], Animd[TransTo][1][2])
- return {
- Configuration.CFrameTrans(Animd[TransFrom][3], Animd[TransTo][3], TransAmm),
- Configuration.CFrameTrans(Animd[TransFrom][4], Animd[TransTo][4], TransAmm),
- Configuration.CFrameTrans(Animd[TransFrom][5], Animd[TransTo][5], TransAmm),
- Configuration.NumTrans(Animd[TransFrom][2], Animd[TransTo][2], TransAmm)
- }
- end
- end
- return Configuration
- end))
- ModuleScript2.Name = "Functions"
- ModuleScript2.Parent = Script0
- table.insert(cors,sandbox(ModuleScript2,function()
- --Rescripted by Luckymaxer
- Players = game:GetService("Players")
- Debris = game:GetService("Debris")
- RbxUtility = LoadLibrary("RbxUtility")
- Create = RbxUtility.Create
- Functions = {}
- function Functions.Clamp(Number, Min, Max)
- return math.max(math.min(Max, Number), Min)
- end
- function Functions.GetPercentage(Start, End, Number)
- return (((Number - Start) / (End - Start)) * 100)
- end
- function Functions.Round(Number, RoundDecimal)
- local WholeNumber, Decimal = math.modf(Number)
- return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
- end
- function Functions.IsTeamMate(Player1, Player2)
- return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
- end
- function Functions.TagHumanoid(humanoid, player)
- local Creator_Tag = Create("ObjectValue"){
- Name = "creator",
- Value = player,
- }
- Debris:AddItem(Creator_Tag, 2)
- Creator_Tag.Parent = humanoid
- end
- function Functions.UntagHumanoid(humanoid)
- for i, v in pairs(humanoid:GetChildren()) do
- if v:IsA("ObjectValue") and v.Name == "creator" then
- v:Destroy()
- end
- end
- end
- function Functions.CheckTableForString(Table, String)
- for i, v in pairs(Table) do
- if string.find(string.lower(String), string.lower(v)) then
- return true
- end
- end
- return false
- end
- function Functions.CheckTableForInstance(Table, Instance)
- for i, v in pairs(Table) do
- if v == Instance then
- return true
- end
- end
- return false
- end
- function Functions.CheckIntangible(Hit)
- local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
- if Hit and Hit.Parent then
- if ((not Hit.CanCollide or Functions.CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then
- return true
- end
- end
- return false
- end
- function Functions.CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
- local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
- local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
- if RayHit and Functions.CheckIntangible(RayHit) then
- if DelayIfHit then
- wait()
- end
- RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
- end
- return RayHit, RayPos, RayNormal
- end
- return Functions
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = tel
- 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