Advertisement
otorp2

give points to plyr

Jun 30th, 2019
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. local pointPart = script.Parent
  2. --local storage = game:GetService("ServerStorage")
  3.  
  4. -- Gives some points
  5. local blue = Color3.fromRGB(0, 0, 255)
  6. -- Gives more points
  7. local green = Color3.fromRGB(0, 255, 0)
  8. -- Makes players lose points
  9. local red = Color3.fromRGB(255 ,0, 0)
  10.  
  11. -- gold given to players
  12. local smallPoints = 10
  13. local largePoints = 50
  14. local losePoints = 100
  15.  
  16. local Players = game:GetService("Players")
  17.  
  18. local function givePoints(player)
  19. local currentColor = pointPart.Color
  20.  
  21. local playerStats = player:WaitForChild("leaderstats")
  22. local playerPoints = playerStats:WaitForChild("Points")
  23.  
  24. -- Gives player gold based on the color of the part
  25. if currentColor == blue then
  26. playerPoints.Value = playerPoints.Value + smallPoints
  27. elseif currentColor == green then
  28. playerPoints.Value = playerPoints.Value + largePoints
  29. else
  30. playerPoints.Value = playerPoints.Value - losePoints
  31. end
  32.  
  33. -- Destroy the part, wait a second, and thne destroy the particle
  34. pointPart:Destroy()
  35.  
  36. -- Creates a sparkles effect and destroys it
  37. local playerCharacter = player.Character
  38. local particle = Instance.new("ParticleEmitter")
  39. particle.Color = ColorSequence.new(currentColor)
  40. particle.Parent = playerCharacter:WaitForChild("Head")
  41. wait(1)
  42. particle:Destroy()
  43.  
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement