Advertisement
Mitko1223tm

rals test

Jan 29th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.33 KB | None | 0 0
  1. -- ralsei by pdnghiaqoi [ marseio ]
  2. -- credit for NopeUsername for his method on moving, too lazy to fix mine so yea
  3. -- Preparing SurfaceGui
  4. SurfaceGui0 = Instance.new("SurfaceGui")
  5. Frame1 = Instance.new("Frame")
  6. ImageLabel2 = Instance.new("ImageLabel")
  7. SurfaceGui0.LightInfluence = 0
  8. SurfaceGui0.Face = Enum.NormalId.Top
  9. SurfaceGui0.ClipsDescendants = true
  10. SurfaceGui0.ZIndexBehavior = Enum.ZIndexBehavior.Global
  11. SurfaceGui0.PixelsPerStud = 1
  12. SurfaceGui0.AlwaysOnTop = false
  13. Frame1.Parent = SurfaceGui0
  14. Frame1.Position = UDim2.new(0.5, -350, 0.5, -350)
  15. Frame1.Size = UDim2.new(0, 700, 0, 700)
  16. Frame1.BackgroundColor = BrickColor.new("Institutional white")
  17. Frame1.Rotation = 180
  18. Frame1.BackgroundColor3 = Color3.new(1, 1, 1)
  19. Frame1.BackgroundTransparency = 1
  20. ImageLabel2.Parent = Frame1
  21. ImageLabel2.Position = UDim2.new(0.5, -2, 0.5, -5)
  22. ImageLabel2.Size = UDim2.new(0, 10, 0, 10)
  23. ImageLabel2.BackgroundColor = BrickColor.new("Institutional white")
  24. ImageLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
  25. ImageLabel2.BackgroundTransparency = 1
  26. ImageLabel2.BorderSizePixel = 0
  27. ImageLabel2.Image = "http://www.roblox.com/asset/?id=4633403985"
  28. ImageLabel2.ScaleType = Enum.ScaleType.Fit
  29. -- Cloning the base
  30. local base = Instance.new("Part")
  31. base.Anchored = true
  32. base.Size = Vector3.new(700,1,700)
  33. base.Transparency = 1
  34. base.Orientation = Vector3.new(0,0,0)
  35. base.CanCollide = false
  36. base.Position = Vector3.new(0,0,0)
  37. base.Parent = script
  38. base.Name = "Base"
  39. SurfaceGui0.Parent = base
  40. -- Before editing, read this.
  41. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  42. --[[
  43. Variables Information:
  44.  
  45. SecondPerFrame: Time between each frame. Default to 0.5 .
  46. Facing: Where your facing at.
  47. Actions: What your character is doing.
  48. FrameTime: How long have the current animation been lasted before looping (which reset the FrameTime to 0). [ read only, you shouldn't change this. ]
  49. CurrentPoint: The current "checkpoint" of the current animation. [ read only, you shouldn't change this. ]
  50. CurrentFrame: The current frame of the current animation. [ read only, you shouldn't change this. ]
  51. CancelRequest: Will accept any fireserver request if set to false. Won't accept if set to true. [ read only, you shouldn't change this. ]
  52. Image: The imagelabel. [ should modify ImageLabel2, not Image. ] [ read only, you shouldn't change this ]
  53. Client: Your client. [ read only, you shouldn't change this ]
  54. Diagonally: Check if the character is moving diagonally. [ read only, you shouldn't change this ]
  55. [Direction].Idle: Sprite when Actions = "Stop" | your character gone idle.
  56. [Direction].Moving: Sprite when Actions = "Moving" | your character is moving.
  57. [Direction].Action: Where you should put your "action" in. Read Action Table Template for more detail to create your own action.
  58.  
  59. ---
  60.  
  61. Function Information:
  62.  
  63. CheckIfActionExist(string): Return true if the given string is included on the current facing's action table. Else return false.
  64.  
  65. only 1 function. same
  66.  
  67. ---
  68.  
  69. Action Table Template:
  70. ActionName = { -- Replace "ActionName" with your actionname
  71. Time = number; -- How long should it last.
  72. Uncancelable = boolean; -- If you want the action unskipable by pressing any key, put it false. Else put it true.
  73. SecondPerFrame = number; -- Time between each frame.
  74. Sprite = {ID1, ID2, ID3, and so on...} -- ImageId for the animation, should be put in correct order.
  75. }
  76.  
  77. Action should be put inside the emotes table in each facing table on Sprites
  78.  
  79. Client Action Key Template:
  80. elseif Input.KeyCode == YourKeyHere then -- Replace "YourKeyHere" with your keycode enum.
  81. Remote:FireServer("ActionName",nil) -- Replace "ActionName" with your emote's name
  82.  
  83. Go to line 280 and replace the comment in that line with your client action key template.
  84.  
  85. ---
  86.  
  87. imagine wasting your time just for this
  88. --]]
  89. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  90. -- Preparing variables
  91. SpriteSettings = {
  92. Sprites = {
  93. SecondPerFrame = .5;
  94. Back = { -- Sprite when facing forward
  95. Idle = 4633403985;
  96. Moving = {4633404360,4633403985,4633404949,4633403985};
  97. Actions = {
  98.  
  99. };
  100. };
  101. Front = { -- Sprite when facing backward
  102. Idle = 4633442064;
  103. Moving = {4633442615,4633442064,4633443258,4633442064};
  104. Actions = {
  105.  
  106. };
  107. };
  108. Left = { -- Sprite when facing left
  109. Idle = 4633434775;
  110. Moving = {4633436524,4633434775,4633437076,4633434775};
  111. Actions = {
  112. Surprise = {
  113. Time = 3;
  114. Uncancelable = true;
  115. SecondPerFrame = 0;
  116. Sprite = {4636528601}
  117. };
  118. Sitting = {
  119. Time = math.huge;
  120. Uncancelable = false;
  121. SecondPerFrame = .5;
  122. Sprite = {4636243245,4636243465}
  123. };
  124. }
  125. };
  126. Right = { -- Sprite when facing right
  127. Idle = 4633433118;
  128. Moving = {4633433658,4633433118,4633434179,4633433118};
  129. Actions = {
  130. Surprise = {
  131. Time = 3;
  132. Uncancelable = true;
  133. SecondPerFrame = 0;
  134. Sprite = {4636528900}
  135. }
  136. }
  137. };
  138. };
  139. Facing = "Front";
  140. Diagonally = nil;
  141. Actions = "Stop";
  142. FrameTime = 0;
  143. CurrentPoint = 0;
  144. CurrentFrame = 0;
  145. CancelRequest = false;
  146. Image = ImageLabel2;
  147. Client = nil;
  148. Remote = Instance.new("RemoteEvent")
  149. }
  150. -- Functions
  151. function CheckIfActionExist(Action)
  152. for i,v in pairs(SpriteSettings.Sprites[SpriteSettings.Facing].Actions) do
  153. if tostring(i) == tostring(Action) then
  154. return true
  155. end
  156. end
  157. return false
  158. end
  159. -- Loops
  160. owner.Character = nil
  161. spawn(function()
  162. while wait() do
  163. if SpriteSettings.Actions == "Stop" then
  164. SpriteSettings.FrameTime = 0
  165. SpriteSettings.Sprites.SecondPerFrame = .5
  166. SpriteSettings.Image.Image = "rbxassetid://"..SpriteSettings.Sprites[SpriteSettings.Facing].Idle
  167. elseif SpriteSettings.Actions == "Moving" then
  168. if SpriteSettings.FrameTime >= 2 then SpriteSettings.FrameTime = 0 end
  169. SpriteSettings.FrameTime = SpriteSettings.FrameTime+.1
  170. if SpriteSettings.FrameTime <= 0.5 then
  171. SpriteSettings.Image.Image = "rbxassetid://"..SpriteSettings.Sprites[SpriteSettings.Facing].Moving[1]
  172. elseif SpriteSettings.FrameTime >= .5 and SpriteSettings.FrameTime < 1 then
  173. SpriteSettings.Image.Image = "rbxassetid://"..SpriteSettings.Sprites[SpriteSettings.Facing].Moving[2]
  174. elseif SpriteSettings.FrameTime >= 1 and SpriteSettings.FrameTime < 1.5 then
  175. SpriteSettings.Image.Image = "rbxassetid://"..SpriteSettings.Sprites[SpriteSettings.Facing].Moving[3]
  176. elseif SpriteSettings.FrameTime >= 1.5 and SpriteSettings.FrameTime < 2 then
  177. SpriteSettings.Image.Image = "rbxassetid://"..SpriteSettings.Sprites[SpriteSettings.Facing].Moving[4]
  178. end
  179. local a = SpriteSettings.Image
  180. if SpriteSettings.Facing == "Front" then
  181. if SpriteSettings.Diagonally == "Left" then
  182. a.Position = UDim2.new(.5,a.Position.X.Offset-1,.5,a.Position.Y.Offset-1)
  183. elseif SpriteSettings.Diagonally == "Right" then
  184. a.Position = UDim2.new(.5,a.Position.X.Offset+1,.5,a.Position.Y.Offset-1)
  185. else
  186. a.Position = UDim2.new(.5,a.Position.X.Offset,.5,a.Position.Y.Offset-1)
  187. end
  188. elseif SpriteSettings.Facing == "Back" then
  189. if SpriteSettings.Diagonally == "Left" then
  190. a.Position = UDim2.new(.5,a.Position.X.Offset-1,.5,a.Position.Y.Offset+1)
  191. elseif SpriteSettings.Diagonally == "Right" then
  192. a.Position = UDim2.new(.5,a.Position.X.Offset+1,.5,a.Position.Y.Offset+1)
  193. else
  194. a.Position = UDim2.new(.5,a.Position.X.Offset,.5,a.Position.Y.Offset+1)
  195. end
  196. elseif SpriteSettings.Facing == "Left" then
  197. a.Position = UDim2.new(.5,a.Position.X.Offset-1,.5,a.Position.Y.Offset)
  198. elseif SpriteSettings.Facing == "Right" then
  199. a.Position = UDim2.new(.5,a.Position.X.Offset+1,.5,a.Position.Y.Offset)
  200. end
  201. SpriteSettings.Remote:FireClient(owner,a.Position.X.Offset,a.Position.Y.Offset)
  202. else
  203. local sprite = SpriteSettings.Sprites[SpriteSettings.Facing].Actions[SpriteSettings.Actions]
  204. SpriteSettings.CancelRequest = sprite.Uncancelable
  205. SpriteSettings.FrameTime = SpriteSettings.FrameTime+.1
  206. if SpriteSettings.FrameTime >= SpriteSettings.CurrentPoint and SpriteSettings.CurrentFrame < #sprite.Sprite then
  207. SpriteSettings.CurrentPoint = SpriteSettings.CurrentPoint + sprite.SecondPerFrame
  208. SpriteSettings.CurrentFrame = SpriteSettings.CurrentFrame + 1
  209. SpriteSettings.Image.Image = "rbxassetid://"..sprite.Sprite[SpriteSettings.CurrentFrame]
  210. end
  211. if SpriteSettings.FrameTime >= sprite.Time then
  212. SpriteSettings.FrameTime = 0
  213. SpriteSettings.CurrentPoint = 0;
  214. SpriteSettings.CurrentFrame = 0;
  215. SpriteSettings.Actions = "Stop"
  216. SpriteSettings.CancelRequest = false
  217. end
  218. end
  219. end
  220. end)
  221. -- Events
  222. SpriteSettings.Client = NLS([[
  223. print("ralsei by pdnghiaqoi [ marseio ]")
  224. Remote = script:WaitForChild("ralsei")
  225. UIS = game:GetService("UserInputService")
  226. Keys = {W = false; S = false; A = false; D = false}
  227. Action = nil
  228. Diagonally = false
  229. local x = 0
  230. local z = 0
  231. workspace.CurrentCamera.CameraSubject = nil
  232. workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
  233. workspace.CurrentCamera.CFrame = CFrame.new(Vector3.new(0,75,0),Vector3.new(0,0,0))
  234. workspace.CurrentCamera.FieldOfView = 70
  235. game:GetService("RunService").Heartbeat:Connect(function()
  236. local KeysPressed = UIS:GetKeysPressed()
  237. if Keys.W then
  238. if #KeysPressed == 1 then
  239. Remote:FireServer("Moving","Front")
  240. else
  241. if UIS:IsKeyDown(Enum.KeyCode.A) then
  242. Remote:FireServer("Moving","Front","Left")
  243. elseif UIS:IsKeyDown(Enum.KeyCode.D) then
  244. Remote:FireServer("Moving","Front","Right")
  245. end
  246. end
  247. end
  248. if Keys.A then
  249. if #KeysPressed == 1 then
  250. Remote:FireServer("Moving","Left")
  251. else
  252. if UIS:IsKeyDown(Enum.KeyCode.S) then
  253. Remote:FireServer("Moving","Back","Left")
  254. end
  255. end
  256. end
  257. if Keys.S then
  258. if #KeysPressed == 1 then
  259. Remote:FireServer("Moving","Back")
  260. else
  261. if UIS:IsKeyDown(Enum.KeyCode.D) then
  262. Remote:FireServer("Moving","Back","Right")
  263. end
  264. end
  265. end
  266. if Keys.D then
  267. if #KeysPressed == 1 then
  268. Remote:FireServer("Moving","Right")
  269. end
  270. end
  271. end)
  272. UIS.InputBegan:Connect(function(Input,GP)
  273. if not GP then
  274. if Input.UserInputType == Enum.UserInputType.Keyboard and Input.UserInputState == Enum.UserInputState.Begin then
  275. Keys[Input.KeyCode.Name] = true
  276. if Input.KeyCode == Enum.KeyCode.E then
  277. Remote:FireServer("Sitting",nil)
  278. elseif Input.KeyCode == Enum.KeyCode.Q then
  279. Remote:FireServer("Surprise",nil)
  280. -- Put your client action key template here.
  281. end
  282. end
  283. end
  284. end)
  285.  
  286. UIS.InputEnded:Connect(function(Input,GP)
  287. if not GP then
  288. if Input.UserInputType == Enum.UserInputType.Keyboard and Input.UserInputState == Enum.UserInputState.End then
  289. Keys[Input.KeyCode.Name] = false
  290. if #UIS:GetKeysPressed() == 0 then
  291. Remote:FireServer("Stop")
  292. end
  293. end
  294. end
  295. end)
  296. local yspeed = 1.145
  297. local xspeed = 0.875
  298. Remote.OnClientEvent:Connect(function(x,y)
  299. workspace.CurrentCamera.CFrame = CFrame.new(Vector3.new(-y*yspeed,75,x*xspeed),Vector3.new(-y*yspeed,0,x*xspeed))
  300. end)
  301. ]],owner:FindFirstChildOfClass("Backpack"))
  302. SpriteSettings.Remote.Name = "ralsei"
  303. SpriteSettings.Remote.Parent = SpriteSettings.Client
  304. SpriteSettings.Remote.OnServerEvent:Connect(function(Client,Type,Data,Extra)
  305. if not SpriteSettings.CancelRequest then
  306. if Type == "Moving" then
  307. SpriteSettings.Actions = Type
  308. SpriteSettings.Facing = Data
  309. SpriteSettings.Diagonally = Extra or nil
  310. elseif Type == "StopDiagonally" then
  311. SpriteSettings.Diagonally = nil
  312. elseif Type == "Stop" or CheckIfActionExist(Type) then
  313. SpriteSettings.FrameTime = 0
  314. SpriteSettings.CurrentPoint = 0;
  315. SpriteSettings.CurrentFrame = 0;
  316. SpriteSettings.Actions = Type
  317. end
  318. end
  319. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement