Advertisement
filipaopastebins2134

KoGaMa Checkpoint

Mar 8th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. -- Converted using Mokiros's Model to Script plugin
  2. -- Converted string size: 472
  3.  
  4. local Scripts = { function()
  5. local spawn = script.Parent
  6. spawn.Touched:connect(function(hit)
  7. if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
  8. local player = game.Players:GetPlayerFromCharacter(hit.Parent)
  9. local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
  10. if not checkpointData then
  11. checkpointData = Instance.new("Model", game.ServerStorage)
  12. checkpointData.Name = "CheckpointData"
  13. end
  14.  
  15. local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
  16. if not checkpoint then
  17. checkpoint = Instance.new("ObjectValue", checkpointData)
  18. checkpoint.Name = tostring(player.userId)
  19.  
  20. player.CharacterAdded:connect(function(character)
  21. wait()
  22. character:WaitForChild("HumanoidRootPart").CFrame = game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
  23. end)
  24. end
  25.  
  26. checkpoint.Value = spawn
  27. end
  28. end)
  29. end;}local ActualScripts = {}
  30. function s(var)
  31. local func = table.remove(Scripts,1)
  32. local env = getfenv(func)
  33. local newenv = setmetatable({},{
  34. __index = function(self,k)
  35. if k=="script" then
  36. return var
  37. else
  38. return env[k]
  39. end
  40. end,
  41. })
  42. setfenv(func,newenv)
  43. table.insert(ActualScripts,coroutine.wrap(func))
  44. end
  45.  
  46. local Decode = function(str,t,props,classes,values,ICList,Model,CurPar,LastIns,split,RemoveAndSplit,InstanceList)
  47. local tonum,table_remove,inst,parnt,comma,table_foreach = tonumber,table.remove,Instance.new,"Parent",",",
  48. function(t,f)
  49. for a,b in pairs(t) do
  50. f(a,b)
  51. end
  52. end
  53. local Types = {
  54. Color3 = Color3.new,
  55. Vector3 = Vector3.new,
  56. Vector2 = Vector2.new,
  57. UDim = UDim.new,
  58. UDim2 = UDim2.new,
  59. CFrame = CFrame.new,
  60. Rect = Rect.new,
  61. NumberSequence = function(...)
  62. local a = {...}
  63. local t = {}
  64. repeat
  65. t[#t+1] = NumberSequenceKeypoint.new(table_remove(a,1),table_remove(a,1),table_remove(a,1))
  66. until #a==0
  67. return NumberSequence.new(t)
  68. end,
  69. ColorSequence = function(...)
  70. local a = {...}
  71. local t = {}
  72. repeat
  73. t[#t+1] = ColorSequenceKeypoint.new(table_remove(a,1),Color3.new(table_remove(a,1),table_remove(a,1),table_remove(a,1)))
  74. until #a==0
  75. return ColorSequence.new(t)
  76. end,
  77. number = tonumber,
  78. boolean = function(a)
  79. return a=="true"
  80. end
  81. }
  82. split = function(str,sep)
  83. if not str then return end
  84. local fields = {}
  85. local ConcatNext = false
  86. str:gsub(("([^%s]+)"):format(sep),function(c)
  87. if ConcatNext == true then
  88. fields[#fields] = fields[#fields]..sep..c
  89. ConcatNext = false
  90. else
  91. fields[#fields+1] = c
  92. end
  93. if c:sub(#c)=="\\" then
  94. c = fields[#fields]
  95. fields[#fields] = c:sub(1,#c-1)
  96. ConcatNext = true
  97. end
  98. end)
  99. return fields
  100. end
  101. RemoveAndSplit = function(t)
  102. return split(table_remove(t,1),comma)
  103. end
  104. t = split(str,";")
  105. props = RemoveAndSplit(t)
  106. classes = RemoveAndSplit(t)
  107. values = split(table_remove(t,1),'|')
  108. ICList = RemoveAndSplit(t)
  109. InstanceList = {}
  110. Model = inst"Model"
  111. CurPar = Model
  112. table_foreach(t,function(ct,c)
  113. if c=="n" or c=="p" then
  114. CurPar = c=="n" and LastIns or CurPar[parnt]
  115. else
  116. ct = split(c,"|")
  117. local class = classes[tonum(table_remove(ct,1))]
  118. if class=="UnionOperation" then
  119. LastIns = {Locked="true",Anchored="true",UsePartColor="true"}
  120. else
  121. LastIns = inst(class)
  122. if LastIns:IsA"Script" then
  123. s(LastIns)
  124. end
  125. end
  126.  
  127. local function SetProperty(LastIns,p,str,s)
  128. s = Types[typeof(LastIns[p])]
  129. LastIns[p] = s and s(unpack(split(str,comma))) or str
  130. end
  131.  
  132. local UnionData
  133. table_foreach(ct,function(s,p,a,str)
  134. a = p:find":"
  135. p,str = props[tonum(p:sub(1,a-1))],values[tonum(p:sub(a+1))]
  136. if p=="UnionData" then
  137. UnionData = split(str," ")
  138. return
  139. end
  140. if class=="UnionOperation" then
  141. LastIns[p] = str
  142. return
  143. end
  144. SetProperty(LastIns,p,str)
  145. end)
  146.  
  147. if UnionData then
  148. local LI_Data = LastIns
  149. LastIns = DecodeUnion(UnionData)
  150. table_foreach(LI_Data,function(p,str)
  151. SetProperty(LastIns,p,str)
  152. end)
  153. end
  154. table.insert(InstanceList,LastIns)
  155. LastIns[parnt] = CurPar
  156. end
  157. end)
  158. table_remove(ICList,1)
  159. table_foreach(ICList,function(a,b)
  160. b = split(b,">")
  161. InstanceList[tonum(b[1])][props[tonum(b[2])]] = InstanceList[tonum(b[3])]
  162. end)
  163.  
  164. return Model
  165. end
  166.  
  167. local Model = Decode('Name,Anchored,Color,Position,Size,BottomSurface,TopSurface,C0,C1,Part0,Part1,CanCollide;Part,Script,SpecialMesh,ManualWeld;Part|Checkpoint|true|0.066,0.066,0.066|-48,0.5,-9|4,1,4|Smooth|Checkpoint-to-'
  168. ..'Block-to-Checkpoint Strong Joint|-2,0.5,2,-1,0,0,0,0,1,0,1,0|-1.92,-3.591,1.843,-1,0,0,0,0,1,0,1,0|Block-to-Checkpoint|-48.081,4.59,-8.844|1,7.18,1;0,4>10>1,4>11>5;1|1:2|2:3|3:4|4:5|5:6|6:7|7:7|3:4|3:'
  169. ..'4;n;2;3;4|1:8|8:9|9:10;p;1|1:11|2:3|3:4|4:12|5:13|6:7|7:7|3:4|3:4;n;3;p;')
  170. Model.Parent = script and script.Parent==workspace and script or workspace
  171. for _,f in pairs(ActualScripts) do f() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement