Advertisement
Guest User

Server Script

a guest
Jul 19th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.47 KB | None | 0 0
  1. --//Server Main\\--
  2.  
  3. --// GENERAL \\--
  4. local Tool = script.Parent
  5. local ReplicatedStoragePackage = game.ReplicatedStorage:WaitForChild("HiddenBladeStuff")
  6.  
  7. --// REMOTES \\--
  8. local RemoteFolder = ReplicatedStoragePackage:WaitForChild("Remotes")
  9. local Damager = RemoteFolder:WaitForChild("Damager")
  10. local Giver = RemoteFolder:WaitForChild("Giver")
  11. local Remover = RemoteFolder:WaitForChild("Remover")
  12. local Starter = RemoteFolder:WaitForChild("Starter")
  13.  
  14. --// ANIMATIONS \\--
  15. local AnimationsFolder = ReplicatedStoragePackage:WaitForChild("Animations")
  16. local Idle = AnimationsFolder:WaitForChild("Idle")
  17. local Sheath = AnimationsFolder:WaitForChild("Sheath")
  18. local Attack = AnimationsFolder:WaitForChild("Attack")
  19.  
  20. --// VALUES \\--
  21. local ValuesFolder = ReplicatedStoragePackage:WaitForChild("Values")
  22. local hasEquipped = ValuesFolder:WaitForChild("hasEquipped")
  23. local killCount = ValuesFolder:WaitForChild("killCount")
  24. local isVictimHumanoid = ValuesFolder:WaitForChild("isVictimHumanoid")
  25.  
  26. --// SETTINGS \\--
  27. local ConfigFile = Tool:WaitForChild("Settings")
  28. local Damage = ConfigFile:WaitForChild("Damage")
  29. local Distance = ConfigFile:WaitForChild("Distance")
  30.  
  31. --// MODELS \\--
  32. local ModelsFolder = ReplicatedStoragePackage:WaitForChild("Models")
  33. local HiddenBlade = ModelsFolder:WaitForChild("HiddenBlade")
  34.  
  35.                                                                             --[[       // REMOTE LISTEN \\      ]]--
  36.  
  37. Starter.OnServerEvent:Connect(function(Client, Humanoid, RightLowerArm)
  38.    
  39.     --// ANIMATION TRACKS \\--
  40.     local IdleTrack = Humanoid:LoadAnimation(Idle)
  41.     local SheathTrack = Humanoid:LoadAnimation(Sheath)
  42.     local AttackTrack = Humanoid:LoadAnimation(Attack)
  43.    
  44.     --// LOCAL FUNCTIONS \\--
  45.     local function ghb()
  46.         local CloneHiddenBlade = HiddenBlade:Clone()
  47.         CloneHiddenBlade.Parent = RightLowerArm
  48.         local WeldHiddenBlade = Instance.new("Weld", RightLowerArm)
  49.         WeldHiddenBlade.Name = "WeldHiddenBlade"
  50.         WeldHiddenBlade.Part0 = CloneHiddenBlade.PrimaryPart
  51.         WeldHiddenBlade.Part1 = RightLowerArm
  52.         print("Added the Hidden Blade")
  53.     end
  54.    
  55.     local function unghb()
  56.         local CloneHiddenBlade = RightLowerArm:FindFirstChild("HiddenBlade")
  57.         local WeldHiddenBlade = RightLowerArm:FindFirstChild("WeldHiddenBlade")
  58.         CloneHiddenBlade:Destroy()
  59.         WeldHiddenBlade:Destroy()
  60.         print("Removed the Hidden Blade")
  61.     end
  62.    
  63.     Damager.OnServerEvent:Connect(function(Client, VictimHumanoid, Damage)
  64.         AttackTrack:Play()
  65.         VictimHumanoid:TakeDamage(Damage.Value)
  66.         print(VictimHumanoid.Parent.Name.." has died...")
  67.     end)
  68. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement