Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. local dialog = script.Parent
  2. dialog.DialogChoiceSelected:connect(function(player, choice)
  3. -- Check the player has a stats object
  4. local stats = player:FindFirstChild('leaderstats')
  5. if not stats then return end
  6.  
  7. -- And that the stats object contains a gold member
  8. local Points = stats:FindFirstChild('Points')
  9. if not Points then return end
  10.  
  11. if choice == script.Parent.DialogChoice.ChoiceA then
  12. if Points.Value >= 100 then -- 5 is the amount of gold you need to purchase this weapon
  13. game.ReplicatedStorage.InvisibleLegs:Clone().Parent = player.Character
  14. Points.Value = Points.Value - 100 -- subtract the amount of gold you need to purchase
  15. wait(3)
  16. chats = {"That will be 100 Points please!"}
  17. game:GetService("Chat"):Chat(script.Parent.Parent.Parent.Head, chats[math.random(1, #chats)], Enum.ChatColor.Green)
  18. else
  19. chats = {"Insufficent Funds!"}
  20. wait(3)
  21. game:GetService("Chat"):Chat(script.Parent.Parent.Parent.Head, chats[math.random(1, #chats)], Enum.ChatColor.Red)
  22. end
  23. elseif choice == dialog.DialogChoice.ChoiceB then
  24. if Points.Value >= 150 then
  25. game.Lighting.InvisibleArms:Clone().Parent = player.Character
  26. Points.Value = Points.Value - 150
  27. wait(3)
  28. chats = {"That will be 150 Points please!"}
  29. game:GetService("Chat"):Chat(script.Parent.Parent.Parent.Head, chats[math.random(1, #chats)], Enum.ChatColor.Green)
  30. else
  31. chats = {"Insufficent Funds!"}
  32. wait(3)
  33. game:GetService("Chat"):Chat(script.Parent.Parent.Parent.Head, chats[math.random(1, #chats)], Enum.ChatColor.Red)
  34. end
  35. elseif choice == dialog.DialogChoice.ChoiceC then
  36. if Points.Value >= 200 then
  37. game.ReplicatedStorage.InvisibleTorso:Clone().Parent = player.Character
  38. Points.Value = Points.Value - 200
  39. wait(3)
  40. chats = {"That will be 200 Points please!"}
  41. game:GetService("Chat"):Chat(script.Parent.Parent.Parent.Head, chats[math.random(1, #chats)], Enum.ChatColor.Green)
  42. else
  43. chats = {"Insufficent Funds!"}
  44. wait(3)
  45. game:GetService("Chat"):Chat(script.Parent.Parent.Parent.Head, chats[math.random(1, #chats)], Enum.ChatColor.Red)
  46. end
  47. end
  48. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement