SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,game,owner = owner,game | |
4 | local RealPlayer = Player | |
5 | do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end | |
6 | --Converted with ttyyuu12345's model to script plugin v4 | |
7 | function sandbox(var,func) | |
8 | local env = getfenv(func) | |
9 | local newenv = setmetatable({},{ | |
10 | __index = function(self,k) | |
11 | if k=="script" then | |
12 | return var | |
13 | else | |
14 | return env[k] | |
15 | end | |
16 | end, | |
17 | }) | |
18 | setfenv(func,newenv) | |
19 | return func | |
20 | end | |
21 | cors = {} | |
22 | mas = Instance.new("Model",game:GetService("Lighting")) | |
23 | Model0 = Instance.new("Model") | |
24 | Part1 = Instance.new("Part") | |
25 | Script2 = Instance.new("Script") | |
26 | ScreenGui3 = Instance.new("ScreenGui") | |
27 | Frame4 = Instance.new("Frame") | |
28 | ImageLabel5 = Instance.new("ImageLabel") | |
29 | Script6 = Instance.new("Script") | |
30 | Script7 = Instance.new("Script") | |
31 | Script8 = Instance.new("Script") | |
32 | Sound9 = Instance.new("Sound") | |
33 | ImageLabel10 = Instance.new("ImageLabel") | |
34 | Script11 = Instance.new("Script") | |
35 | Script12 = Instance.new("Script") | |
36 | Sound13 = Instance.new("Sound") | |
37 | Part14 = Instance.new("Part") | |
38 | Motor6D15 = Instance.new("Motor6D") | |
39 | Motor6D16 = Instance.new("Motor6D") | |
40 | Motor6D17 = Instance.new("Motor6D") | |
41 | Motor6D18 = Instance.new("Motor6D") | |
42 | Motor6D19 = Instance.new("Motor6D") | |
43 | BodyForce20 = Instance.new("BodyForce") | |
44 | Part21 = Instance.new("Part") | |
45 | Part22 = Instance.new("Part") | |
46 | Part23 = Instance.new("Part") | |
47 | Part24 = Instance.new("Part") | |
48 | Part25 = Instance.new("Part") | |
49 | SpecialMesh26 = Instance.new("SpecialMesh") | |
50 | SpotLight27 = Instance.new("SpotLight") | |
51 | Humanoid28 = Instance.new("Humanoid") | |
52 | Backpack29 = Instance.new("Backpack") | |
53 | Script30 = Instance.new("Script") | |
54 | Script31 = Instance.new("Script") | |
55 | ObjectValue32 = Instance.new("ObjectValue") | |
56 | Script33 = Instance.new("Script") | |
57 | StringValue34 = Instance.new("StringValue") | |
58 | Animation35 = Instance.new("Animation") | |
59 | StringValue36 = Instance.new("StringValue") | |
60 | Animation37 = Instance.new("Animation") | |
61 | StringValue38 = Instance.new("StringValue") | |
62 | Animation39 = Instance.new("Animation") | |
63 | NumberValue40 = Instance.new("NumberValue") | |
64 | Animation41 = Instance.new("Animation") | |
65 | NumberValue42 = Instance.new("NumberValue") | |
66 | StringValue43 = Instance.new("StringValue") | |
67 | Animation44 = Instance.new("Animation") | |
68 | StringValue45 = Instance.new("StringValue") | |
69 | Animation46 = Instance.new("Animation") | |
70 | StringValue47 = Instance.new("StringValue") | |
71 | Animation48 = Instance.new("Animation") | |
72 | StringValue49 = Instance.new("StringValue") | |
73 | Animation50 = Instance.new("Animation") | |
74 | StringValue51 = Instance.new("StringValue") | |
75 | Animation52 = Instance.new("Animation") | |
76 | Script53 = Instance.new("Script") | |
77 | Script54 = Instance.new("Script") | |
78 | Script55 = Instance.new("Script") | |
79 | Script56 = Instance.new("Script") | |
80 | Part57 = Instance.new("Part") | |
81 | Motor6D58 = Instance.new("Motor6D") | |
82 | SpecialMesh59 = Instance.new("SpecialMesh") | |
83 | Part60 = Instance.new("Part") | |
84 | BillboardGui61 = Instance.new("BillboardGui") | |
85 | ImageLabel62 = Instance.new("ImageLabel") | |
86 | Script63 = Instance.new("Script") | |
87 | Part64 = Instance.new("Part") | |
88 | Part65 = Instance.new("Part") | |
89 | Part66 = Instance.new("Part") | |
90 | BillboardGui67 = Instance.new("BillboardGui") | |
91 | ImageLabel68 = Instance.new("ImageLabel") | |
92 | Script69 = Instance.new("Script") | |
93 | Camera70 = Instance.new("Camera") | |
94 | Model0.Name = "Ignited Bonnie" | |
95 | Model0.Parent = mas | |
96 | Part1.Name = "Jumpscare Box" | |
97 | Part1.Parent = Model0 | |
98 | Part1.CFrame = CFrame.new(-18.7641983, 3.59502602, 236.232513, 4.49431016e-21, -6.79974523e-22, -1, 4.72251821e-22, 1, -6.79974523e-22, 1, -4.72251821e-22, 4.49431016e-21) | |
99 | Part1.Orientation = Vector3.new(0, -90, 0) | |
100 | Part1.Position = Vector3.new(-18.7641983, 3.59502602, 236.232513) | |
101 | Part1.Rotation = Vector3.new(0, -90, 0) | |
102 | Part1.Color = Color3.new(0.152941, 0.27451, 0.176471) | |
103 | Part1.Transparency = 1 | |
104 | Part1.Size = Vector3.new(3.43617249, 7.18966675, 3.5197773) | |
105 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
106 | Part1.BrickColor = BrickColor.new("Earth green") | |
107 | Part1.CanCollide = false | |
108 | Part1.Material = Enum.Material.WoodPlanks | |
109 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
110 | Part1.brickColor = BrickColor.new("Earth green") | |
111 | Part1.FormFactor = Enum.FormFactor.Symmetric | |
112 | Part1.formFactor = Enum.FormFactor.Symmetric | |
113 | Script2.Name = "S2" | |
114 | Script2.Parent = Part1 | |
115 | table.insert(cors,sandbox(Script2,function() | |
116 | ||
117 | Popup = script.Parent.Popup | |
118 | Ready = true | |
119 | function onTouch(hit) | |
120 | local h = hit.Parent:FindFirstChild("Humanoid") | |
121 | if h ~= nil and Ready == true then | |
122 | Ready = false | |
123 | local plyr = game.Players:FindFirstChild(h.Parent.Name) | |
124 | wait() | |
125 | local c = Popup:clone() | |
126 | c.Parent = plyr.PlayerGui | |
127 | c.BackGround.Image.StuffScript.Disabled=false | |
128 | h.Health=0 | |
129 | wait(1) | |
130 | wait(.1) | |
131 | ||
132 | c:remove() | |
133 | wait(1) | |
134 | Ready = true | |
135 | end | |
136 | end | |
137 | ||
138 | script.Parent.Touched:connect(onTouch) | |
139 | ||
140 | end)) | |
141 | ScreenGui3.Name = "Popup" | |
142 | ScreenGui3.Parent = Part1 | |
143 | Frame4.Name = "BackGround" | |
144 | Frame4.Parent = ScreenGui3 | |
145 | Frame4.Position = UDim2.new(0, 0, -0.100000001, 0) | |
146 | Frame4.Size = UDim2.new(1.10000002, 0, 1.20000005, 0) | |
147 | Frame4.BackgroundColor = BrickColor.new("Black metallic") | |
148 | Frame4.BackgroundColor3 = Color3.new(0.109804, 0.109804, 0.109804) | |
149 | Frame4.BackgroundTransparency = 1 | |
150 | ImageLabel5.Name = "Image" | |
151 | ImageLabel5.Parent = Frame4 | |
152 | ImageLabel5.Position = UDim2.new(-0.200000003, -66, -0.100000001, -9) | |
153 | ImageLabel5.Rotation = 4.6521444320679 | |
154 | ImageLabel5.Size = UDim2.new(1.29999995, 0, 1.29999995, 0) | |
155 | ImageLabel5.BackgroundColor = BrickColor.new("Really black") | |
156 | ImageLabel5.BackgroundColor3 = Color3.new(0, 0, 0) | |
157 | ImageLabel5.BackgroundTransparency = 1 | |
158 | ImageLabel5.Image = "rbxassetid://940919723" | |
159 | Script6.Parent = ImageLabel5 | |
160 | table.insert(cors,sandbox(Script6,function() | |
161 | while wait() do | |
162 | script.Parent.Rotation = math.sin(tick() * 50) * 10 | |
163 | end | |
164 | end)) | |
165 | Script7.Name = "IntroGUI Script [READ]" | |
166 | Script7.Parent = ImageLabel5 | |
167 | table.insert(cors,sandbox(Script7,function() | |
168 | ||
169 | while true do | |
170 | script.Parent.Position = script.Parent.Position + UDim2.new(0, math.random(-100, 100), 0, math.random(-100, 100)) | |
171 | wait(0.02) | |
172 | script.Parent.Position = UDim2.new(-0.2, 0,-0.1, 0) | |
173 | wait(0.02) | |
174 | end | |
175 | ||
176 | end)) | |
177 | Script8.Name = "StuffScript" | |
178 | Script8.Parent = ImageLabel5 | |
179 | table.insert(cors,sandbox(Script8,function() | |
180 | script.Sound:play() | |
181 | de = 0 | |
182 | repeat wait() de = de + 1 script.Parent.Parent.Size = script.Parent.Parent.Size + UDim2.new(0, 60, 0, 40) | |
183 | script.Parent.Parent.Position = script.Parent.Parent.Position + UDim2.new(0, -30, 0, -20) until de == 40 | |
184 | ||
185 | ||
186 | script.Parent.Parent.Static.Visible=true | |
187 | script.Parent.Parent.Scream2:play() | |
188 | wait(.1) | |
189 | script.Sound:stop() | |
190 | wait(.1) | |
191 | script.Parent:remove() | |
192 | end)) | |
193 | Script8.Disabled = true | |
194 | Sound9.Parent = Script8 | |
195 | Sound9.EmitterSize = 0 | |
196 | Sound9.MinDistance = 0 | |
197 | Sound9.Pitch = 1.5 | |
198 | Sound9.PlaybackSpeed = 1.5 | |
199 | Sound9.SoundId = "rbxassetid://752370783" | |
200 | Sound9.Volume = 1 | |
201 | ImageLabel10.Name = "Static" | |
202 | ImageLabel10.Parent = Frame4 | |
203 | ImageLabel10.Position = UDim2.new(-0.200000003, -56, -0.100000001, 65) | |
204 | ImageLabel10.Rotation = 4.6577825546265 | |
205 | ImageLabel10.Visible = false | |
206 | ImageLabel10.Size = UDim2.new(1, 0, 1, 0) | |
207 | ImageLabel10.BackgroundColor = BrickColor.new("Dark grey metallic") | |
208 | ImageLabel10.BackgroundColor3 = Color3.new(0.356863, 0.356863, 0.364706) | |
209 | ImageLabel10.BorderSizePixel = 0 | |
210 | ImageLabel10.ZIndex = 10 | |
211 | ImageLabel10.Image = "rbxassetid://125514848" | |
212 | ImageLabel10.ImageColor3 = Color3.new(0, 0, 0) | |
213 | Script11.Name = "IntroGUI Script [READ]" | |
214 | Script11.Parent = ImageLabel10 | |
215 | table.insert(cors,sandbox(Script11,function() | |
216 | ||
217 | while true do | |
218 | script.Parent.Position = script.Parent.Position + UDim2.new(0, math.random(-100, 100), 0, math.random(-100, 100)) | |
219 | wait(0.05) | |
220 | script.Parent.Position = UDim2.new(-0.2, 0,-0.1, 0) | |
221 | wait(0.05) | |
222 | end | |
223 | ||
224 | end)) | |
225 | Script12.Parent = ImageLabel10 | |
226 | table.insert(cors,sandbox(Script12,function() | |
227 | while wait() do | |
228 | script.Parent.Rotation = math.sin(tick() * 0) * 10 | |
229 | end | |
230 | end)) | |
231 | Sound13.Name = "Scream2" | |
232 | Sound13.Parent = Frame4 | |
233 | Sound13.Looped = true | |
234 | Sound13.EmitterSize = 0 | |
235 | Sound13.MinDistance = 0 | |
236 | Sound13.Volume = 1 | |
237 | Part14.Name = "Torso" | |
238 | Part14.Parent = Model0 | |
239 | Part14.CFrame = CFrame.new(-18.7492905, 3.00002193, 236.262543, 4.49431016e-21, -6.79974523e-22, -1, 4.72251821e-22, 1, -6.79974523e-22, 1, -4.72251821e-22, 4.49431016e-21) | |
240 | Part14.Orientation = Vector3.new(0, -90, 0) | |
241 | Part14.Position = Vector3.new(-18.7492905, 3.00002193, 236.262543) | |
242 | Part14.Rotation = Vector3.new(0, -90, 0) | |
243 | Part14.Color = Color3.new(0.152941, 0.27451, 0.176471) | |
244 | Part14.Transparency = 1 | |
245 | Part14.Size = Vector3.new(2, 2, 1) | |
246 | Part14.BottomSurface = Enum.SurfaceType.Smooth | |
247 | Part14.BrickColor = BrickColor.new("Earth green") | |
248 | Part14.Material = Enum.Material.WoodPlanks | |
249 | Part14.TopSurface = Enum.SurfaceType.Smooth | |
250 | Part14.brickColor = BrickColor.new("Earth green") | |
251 | Part14.FormFactor = Enum.FormFactor.Symmetric | |
252 | Part14.formFactor = Enum.FormFactor.Symmetric | |
253 | Motor6D15.Name = "Left Hip" | |
254 | Motor6D15.Parent = Part14 | |
255 | Motor6D15.MaxVelocity = 0.10000000149012 | |
256 | Motor6D15.C0 = CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08) | |
257 | Motor6D15.C1 = CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08) | |
258 | Motor6D15.Part0 = Part14 | |
259 | Motor6D15.Part1 = Part21 | |
260 | Motor6D15.part1 = Part21 | |
261 | Motor6D16.Name = "Right Hip" | |
262 | Motor6D16.Parent = Part14 | |
263 | Motor6D16.MaxVelocity = 0.10000000149012 | |
264 | Motor6D16.C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08) | |
265 | Motor6D16.C1 = CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08) | |
266 | Motor6D16.Part0 = Part14 | |
267 | Motor6D16.Part1 = Part22 | |
268 | Motor6D16.part1 = Part22 | |
269 | Motor6D17.Name = "Left Shoulder" | |
270 | Motor6D17.Parent = Part14 | |
271 | Motor6D17.MaxVelocity = 0.10000000149012 | |
272 | Motor6D17.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08) | |
273 | Motor6D17.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08) | |
274 | Motor6D17.Part0 = Part14 | |
275 | Motor6D17.Part1 = Part23 | |
276 | Motor6D17.part1 = Part23 | |
277 | Motor6D18.Name = "Right Shoulder" | |
278 | Motor6D18.Parent = Part14 | |
279 | Motor6D18.MaxVelocity = 0.10000000149012 | |
280 | Motor6D18.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08) | |
281 | Motor6D18.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08) | |
282 | Motor6D18.Part0 = Part14 | |
283 | Motor6D18.Part1 = Part24 | |
284 | Motor6D18.part1 = Part24 | |
285 | Motor6D19.Name = "Neck" | |
286 | Motor6D19.Parent = Part14 | |
287 | Motor6D19.MaxVelocity = 0.10000000149012 | |
288 | Motor6D19.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
289 | Motor6D19.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
290 | Motor6D19.Part0 = Part14 | |
291 | Motor6D19.Part1 = Part25 | |
292 | Motor6D19.part1 = Part25 | |
293 | BodyForce20.Name = "RepulsionForce" | |
294 | BodyForce20.Parent = Part14 | |
295 | BodyForce20.Force = Vector3.new(0, 0, 0) | |
296 | BodyForce20.force = Vector3.new(0, 0, 0) | |
297 | Part21.Name = "Left Leg" | |
298 | Part21.Parent = Model0 | |
299 | Part21.CFrame = CFrame.new(-18.7492905, 1.00002205, 235.762543, 4.49431016e-21, -6.79974422e-22, -1, 4.72251821e-22, 0.999999881, -6.79974523e-22, 1, -4.7225177e-22, 4.49431016e-21) | |
300 | Part21.Orientation = Vector3.new(0, -90, 0) | |
301 | Part21.Position = Vector3.new(-18.7492905, 1.00002205, 235.762543) | |
302 | Part21.Rotation = Vector3.new(0, -90, 0) | |
303 | Part21.Color = Color3.new(0.152941, 0.27451, 0.176471) | |
304 | Part21.Transparency = 1 | |
305 | Part21.Size = Vector3.new(1, 2, 1) | |
306 | Part21.BottomSurface = Enum.SurfaceType.Smooth | |
307 | Part21.BrickColor = BrickColor.new("Earth green") | |
308 | Part21.CanCollide = false | |
309 | Part21.Material = Enum.Material.WoodPlanks | |
310 | Part21.TopSurface = Enum.SurfaceType.Smooth | |
311 | Part21.brickColor = BrickColor.new("Earth green") | |
312 | Part21.FormFactor = Enum.FormFactor.Symmetric | |
313 | Part21.formFactor = Enum.FormFactor.Symmetric | |
314 | Part22.Name = "Right Leg" | |
315 | Part22.Parent = Model0 | |
316 | Part22.CFrame = CFrame.new(-18.7492905, 1.00002205, 236.762543, 4.49431016e-21, -6.79974422e-22, -1, 4.72251821e-22, 0.999999881, -6.79974523e-22, 1, -4.7225177e-22, 4.49431016e-21) | |
317 | Part22.Orientation = Vector3.new(0, -90, 0) | |
318 | Part22.Position = Vector3.new(-18.7492905, 1.00002205, 236.762543) | |
319 | Part22.Rotation = Vector3.new(0, -90, 0) | |
320 | Part22.Color = Color3.new(0.152941, 0.27451, 0.176471) | |
321 | Part22.Transparency = 1 | |
322 | Part22.Size = Vector3.new(1, 2, 1) | |
323 | Part22.BottomSurface = Enum.SurfaceType.Smooth | |
324 | Part22.BrickColor = BrickColor.new("Earth green") | |
325 | Part22.CanCollide = false | |
326 | Part22.Material = Enum.Material.WoodPlanks | |
327 | Part22.TopSurface = Enum.SurfaceType.Smooth | |
328 | Part22.brickColor = BrickColor.new("Earth green") | |
329 | Part22.FormFactor = Enum.FormFactor.Symmetric | |
330 | Part22.formFactor = Enum.FormFactor.Symmetric | |
331 | Part23.Name = "Left Arm" | |
332 | Part23.Parent = Model0 | |
333 | Part23.CFrame = CFrame.new(-18.7492905, 3.00002193, 234.762543, 4.49431016e-21, -6.79974422e-22, -1, 4.72251821e-22, 0.999999881, -6.79974523e-22, 1, -4.7225177e-22, 4.49431016e-21) | |
334 | Part23.Orientation = Vector3.new(0, -90, 0) | |
335 | Part23.Position = Vector3.new(-18.7492905, 3.00002193, 234.762543) | |
336 | Part23.Rotation = Vector3.new(0, -90, 0) | |
337 | Part23.Color = Color3.new(0.152941, 0.27451, 0.176471) | |
338 | Part23.Transparency = 1 | |
339 | Part23.Size = Vector3.new(1, 2, 1) | |
340 | Part23.BottomSurface = Enum.SurfaceType.Smooth | |
341 | Part23.BrickColor = BrickColor.new("Earth green") | |
342 | Part23.CanCollide = false | |
343 | Part23.Material = Enum.Material.WoodPlanks | |
344 | Part23.TopSurface = Enum.SurfaceType.Smooth | |
345 | Part23.brickColor = BrickColor.new("Earth green") | |
346 | Part23.FormFactor = Enum.FormFactor.Symmetric | |
347 | Part23.formFactor = Enum.FormFactor.Symmetric | |
348 | Part24.Name = "Right Arm" | |
349 | Part24.Parent = Model0 | |
350 | Part24.CFrame = CFrame.new(-18.7492905, 3.00002193, 237.762543, 4.49431016e-21, -6.79974422e-22, -1, 4.72251821e-22, 0.999999881, -6.79974523e-22, 1, -4.7225177e-22, 4.49431016e-21) | |
351 | Part24.Orientation = Vector3.new(0, -90, 0) | |
352 | Part24.Position = Vector3.new(-18.7492905, 3.00002193, 237.762543) | |
353 | Part24.Rotation = Vector3.new(0, -90, 0) | |
354 | Part24.Color = Color3.new(0.152941, 0.27451, 0.176471) | |
355 | Part24.Transparency = 1 | |
356 | Part24.Size = Vector3.new(1, 2, 1) | |
357 | Part24.BottomSurface = Enum.SurfaceType.Smooth | |
358 | Part24.BrickColor = BrickColor.new("Earth green") | |
359 | Part24.CanCollide = false | |
360 | Part24.Material = Enum.Material.WoodPlanks | |
361 | Part24.TopSurface = Enum.SurfaceType.Smooth | |
362 | Part24.brickColor = BrickColor.new("Earth green") | |
363 | Part24.FormFactor = Enum.FormFactor.Symmetric | |
364 | Part24.formFactor = Enum.FormFactor.Symmetric | |
365 | Part25.Name = "Head" | |
366 | Part25.Parent = Model0 | |
367 | Part25.CFrame = CFrame.new(-18.7492905, 4.50002193, 236.262543, 4.49431016e-21, -6.79974523e-22, -1, 4.72251821e-22, 1, -6.79974523e-22, 1, -4.72251821e-22, 4.49431016e-21) | |
368 | Part25.Orientation = Vector3.new(0, -90, 0) | |
369 | Part25.Position = Vector3.new(-18.7492905, 4.50002193, 236.262543) | |
370 | Part25.Rotation = Vector3.new(0, -90, 0) | |
371 | Part25.Color = Color3.new(0.227451, 0.490196, 0.0823529) | |
372 | Part25.Transparency = 1 | |
373 | Part25.Size = Vector3.new(2, 1, 1) | |
374 | Part25.BottomSurface = Enum.SurfaceType.Smooth | |
375 | Part25.BrickColor = BrickColor.new("Camo") | |
376 | Part25.Material = Enum.Material.WoodPlanks | |
377 | Part25.TopSurface = Enum.SurfaceType.Smooth | |
378 | Part25.brickColor = BrickColor.new("Camo") | |
379 | Part25.FormFactor = Enum.FormFactor.Symmetric | |
380 | Part25.formFactor = Enum.FormFactor.Symmetric | |
381 | SpecialMesh26.Parent = Part25 | |
382 | SpecialMesh26.Scale = Vector3.new(1.25, 1.25, 1.25) | |
383 | SpotLight27.Parent = Part25 | |
384 | SpotLight27.Color = Color3.new(1, 0, 0) | |
385 | SpotLight27.Range = 30 | |
386 | SpotLight27.Brightness = inf | |
387 | Humanoid28.Parent = Model0 | |
388 | Humanoid28.Health = inf | |
389 | Humanoid28.JumpPower = 20 | |
390 | Humanoid28.LeftLeg = Part21 | |
391 | Humanoid28.MaxHealth = inf | |
392 | Humanoid28.RightLeg = Part22 | |
393 | Humanoid28.Torso = Part57 | |
394 | Humanoid28.WalkSpeed = 30 | |
395 | Humanoid28.maxHealth = inf | |
396 | Backpack29.Name = "AI" | |
397 | Backpack29.Parent = Model0 | |
398 | Script30.Name = "Pathfinding" | |
399 | Script30.Parent = Backpack29 | |
400 | table.insert(cors,sandbox(Script30,function() | |
401 | debugMode = false | |
402 | targetNPCs = false | |
403 | ||
404 | -- | |
405 | ||
406 | h = script.Parent.Parent:WaitForChild("Humanoid") | |
407 | pathService = game:GetService("PathfindingService") | |
408 | targetV = script.Parent:WaitForChild("Target") | |
409 | ||
410 | function closestTargetAndPath() | |
411 | local humanoids = {} | |
412 | if targetNPCs then | |
413 | local function recurse(o) | |
414 | for _,obj in pairs(o:GetChildren()) do | |
415 | if obj:IsA("Model") then | |
416 | if obj:findFirstChild("Humanoid") and obj:findFirstChild("Torso") and obj.Humanoid ~= h and obj.Humanoid.Health > 0 and not obj:findFirstChild("ForceField") then | |
417 | table.insert(humanoids,obj.Humanoid) | |
418 | end | |
419 | end | |
420 | recurse(obj) | |
421 | end | |
422 | end | |
423 | recurse(workspace) | |
424 | else | |
425 | for _,v in pairs(game.Players:GetPlayers()) do | |
426 | if v.Character and v.Character:findFirstChild("HumanoidRootPart") and v.Character:findFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 and not v:findFirstChild("ForceField") then | |
427 | table.insert(humanoids,v.Character.Humanoid) | |
428 | end | |
429 | end | |
430 | end | |
431 | local closest,path,dist | |
432 | for _,humanoid in pairs(humanoids) do | |
433 | local myPath = pathService:ComputeRawPathAsync(h.Torso.Position,humanoid.Torso.Position,500) | |
434 | if myPath.Status ~= Enum.PathStatus.FailFinishNotEmpty then | |
435 | -- Now that we have a successful path, we need to figure out how far we need to actually travel to reach this point. | |
436 | local myDist = 0 | |
437 | local previous = h.Torso.Position | |
438 | for _,point in pairs(myPath:GetPointCoordinates()) do | |
439 | myDist = myDist + (point-previous).magnitude | |
440 | previous = point | |
441 | end | |
442 | if not dist or myDist < dist then -- if true, this is the closest path so far. | |
443 | closest = humanoid | |
444 | path = myPath | |
445 | dist = myDist | |
446 | end | |
447 | end | |
448 | end | |
449 | return closest,path | |
450 | end | |
451 | ||
452 | function goToPos(loc) | |
453 | h:MoveTo(loc) | |
454 | local distance = (loc-h.Torso.Position).magnitude | |
455 | local start = tick() | |
456 | while distance > 4 do | |
457 | if tick()-start > distance/h.WalkSpeed then -- Something may have gone wrong. Just break. | |
458 | break | |
459 | end | |
460 | distance = (loc-h.Torso.Position).magnitude | |
461 | wait() | |
462 | end | |
463 | end | |
464 | ||
465 | while wait() do | |
466 | local target,path = closestTargetAndPath() | |
467 | local didBreak = false | |
468 | local targetStart | |
469 | if target and h.Torso then | |
470 | targetV.Value = target | |
471 | targetStart = target.Torso.Position | |
472 | roaming = false | |
473 | local previous = h.Torso.Position | |
474 | local points = path:GetPointCoordinates() | |
475 | local s = #points > 1 and 2 or 1 | |
476 | for i = s,#points do | |
477 | local point = points[i] | |
478 | if didBreak then | |
479 | break | |
480 | end | |
481 | if target and target.Torso and target.Health > 0 then | |
482 | if (target.Torso.Position-targetStart).magnitude < 1.5 then | |
483 | local pos = previous:lerp(point,.5) | |
484 | local moveDir = ((pos - h.Torso.Position).unit * 2) | |
485 | goToPos(previous:lerp(point,.5)) | |
486 | previous = point | |
487 | end | |
488 | else | |
489 | didBreak = true | |
490 | break | |
491 | end | |
492 | end | |
493 | else | |
494 | targetV.Value = nil | |
495 | end | |
496 | if not didBreak and targetStart then | |
497 | goToPos(targetStart) | |
498 | end | |
499 | end | |
500 | end)) | |
501 | Script31.Name = "AutoJump" | |
502 | Script31.Parent = Backpack29 | |
503 | table.insert(cors,sandbox(Script31,function() | |
504 | local h = script.Parent.Parent:WaitForChild("Humanoid") | |
505 | ||
506 | while wait(math.random()/4) do | |
507 | local check1 = game.Workspace:FindPartOnRay(Ray.new(h.Torso.Position-Vector3.new(0,1.5,0), h.Torso.CFrame.lookVector*3), h.Parent) | |
508 | local check2 = game.Workspace:FindPartOnRay(Ray.new(h.Torso.Position+Vector3.new(0,1.5,0), h.Torso.CFrame.lookVector*3), h.Parent) | |
509 | if check1 or check2 then | |
510 | h.Jump = true | |
511 | end | |
512 | end | |
513 | end)) | |
514 | ObjectValue32.Name = "Target" | |
515 | ObjectValue32.Parent = Backpack29 | |
516 | Script33.Name = "Animate" | |
517 | Script33.Parent = Model0 | |
518 | table.insert(cors,sandbox(Script33,function() | |
519 | -- This is in charge of the animations for the character. Pretty much stole it from the default character. Removed emote stuff. | |
520 | function waitForChild(parent, childName) | |
521 | local child = parent:findFirstChild(childName) | |
522 | if child then return child end | |
523 | while true do | |
524 | child = parent.ChildAdded:wait() | |
525 | if child.Name==childName then return child end | |
526 | end | |
527 | end | |
528 | ||
529 | local Figure = script.Parent | |
530 | local Torso = waitForChild(Figure, "Torso") | |
531 | local RightShoulder = waitForChild(Torso, "Right Shoulder") | |
532 | local LeftShoulder = waitForChild(Torso, "Left Shoulder") | |
533 | local RightHip = waitForChild(Torso, "Right Hip") | |
534 | local LeftHip = waitForChild(Torso, "Left Hip") | |
535 | local Neck = waitForChild(Torso, "Neck") | |
536 | local Humanoid = waitForChild(Figure, "Humanoid") | |
537 | local pose = "Standing" | |
538 | ||
539 | local currentAnim = "" | |
540 | local currentAnimInstance = nil | |
541 | local currentAnimTrack = nil | |
542 | local currentAnimKeyframeHandler = nil | |
543 | local currentAnimSpeed = 1.0 | |
544 | local animTable = {} | |
545 | local animNames = { | |
546 | idle = { | |
547 | { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 }, | |
548 | { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 } | |
549 | }, | |
550 | walk = { | |
551 | { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 } | |
552 | }, | |
553 | run = { | |
554 | { id = "run.xml", weight = 10 } | |
555 | }, | |
556 | jump = { | |
557 | { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 } | |
558 | }, | |
559 | fall = { | |
560 | { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 } | |
561 | }, | |
562 | climb = { | |
563 | { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 } | |
564 | }, | |
565 | sit = { | |
566 | { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 } | |
567 | }, | |
568 | toolnone = { | |
569 | { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 } | |
570 | }, | |
571 | toolslash = { | |
572 | { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 } | |
573 | -- { id = "slash.xml", weight = 10 } | |
574 | }, | |
575 | toollunge = { | |
576 | { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } | |
577 | }, | |
578 | wave = { | |
579 | { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } | |
580 | }, | |
581 | point = { | |
582 | { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } | |
583 | }, | |
584 | dance = { | |
585 | { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 }, | |
586 | { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 }, | |
587 | { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 } | |
588 | }, | |
589 | dance2 = { | |
590 | { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 }, | |
591 | { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 }, | |
592 | { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 } | |
593 | }, | |
594 | dance3 = { | |
595 | { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 }, | |
596 | { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 }, | |
597 | { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 } | |
598 | }, | |
599 | laugh = { | |
600 | { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } | |
601 | }, | |
602 | cheer = { | |
603 | { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } | |
604 | }, | |
605 | } | |
606 | ||
607 | math.randomseed(tick()) | |
608 | ||
609 | function configureAnimationSet(name, fileList) | |
610 | if (animTable[name] ~= nil) then | |
611 | for _, connection in pairs(animTable[name].connections) do | |
612 | connection:disconnect() | |
613 | end | |
614 | end | |
615 | animTable[name] = {} | |
616 | animTable[name].count = 0 | |
617 | animTable[name].totalWeight = 0 | |
618 | animTable[name].connections = {} | |
619 | ||
620 | -- check for config values | |
621 | local config = script:FindFirstChild(name) | |
622 | if (config ~= nil) then | |
623 | -- print("Loading anims " .. name) | |
624 | table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end)) | |
625 | table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end)) | |
626 | local idx = 1 | |
627 | for _, childPart in pairs(config:GetChildren()) do | |
628 | if (childPart:IsA("Animation")) then | |
629 | table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end)) | |
630 | animTable[name][idx] = {} | |
631 | animTable[name][idx].anim = childPart | |
632 | local weightObject = childPart:FindFirstChild("Weight") | |
633 | if (weightObject == nil) then | |
634 | animTable[name][idx].weight = 1 | |
635 | else | |
636 | animTable[name][idx].weight = weightObject.Value | |
637 | end | |
638 | animTable[name].count = animTable[name].count + 1 | |
639 | animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight | |
640 | -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")") | |
641 | idx = idx + 1 | |
642 | end | |
643 | end | |
644 | end | |
645 | ||
646 | -- fallback to defaults | |
647 | if (animTable[name].count <= 0) then | |
648 | for idx, anim in pairs(fileList) do | |
649 | animTable[name][idx] = {} | |
650 | animTable[name][idx].anim = Instance.new("Animation") | |
651 | animTable[name][idx].anim.Name = name | |
652 | animTable[name][idx].anim.AnimationId = anim.id | |
653 | animTable[name][idx].weight = anim.weight | |
654 | animTable[name].count = animTable[name].count + 1 | |
655 | animTable[name].totalWeight = animTable[name].totalWeight + anim.weight | |
656 | -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")") | |
657 | end | |
658 | end | |
659 | end | |
660 | ||
661 | -- Setup animation objects | |
662 | function scriptChildModified(child) | |
663 | local fileList = animNames[child.Name] | |
664 | if (fileList ~= nil) then | |
665 | configureAnimationSet(child.Name, fileList) | |
666 | end | |
667 | end | |
668 | ||
669 | script.ChildAdded:connect(scriptChildModified) | |
670 | script.ChildRemoved:connect(scriptChildModified) | |
671 | ||
672 | ||
673 | for name, fileList in pairs(animNames) do | |
674 | configureAnimationSet(name, fileList) | |
675 | end | |
676 | ||
677 | -- ANIMATION | |
678 | ||
679 | -- declarations | |
680 | local toolAnim = "None" | |
681 | local toolAnimTime = 0 | |
682 | ||
683 | local jumpAnimTime = 0 | |
684 | local jumpAnimDuration = 0.3 | |
685 | ||
686 | local toolTransitionTime = 0.1 | |
687 | local fallTransitionTime = 0.3 | |
688 | local jumpMaxLimbVelocity = 0.75 | |
689 | ||
690 | -- functions | |
691 | ||
692 | function stopAllAnimations() | |
693 | local oldAnim = currentAnim | |
694 | ||
695 | currentAnim = "" | |
696 | currentAnimInstance = nil | |
697 | if (currentAnimKeyframeHandler ~= nil) then | |
698 | currentAnimKeyframeHandler:disconnect() | |
699 | end | |
700 | ||
701 | if (currentAnimTrack ~= nil) then | |
702 | currentAnimTrack:Stop() | |
703 | currentAnimTrack:Destroy() | |
704 | currentAnimTrack = nil | |
705 | end | |
706 | return oldAnim | |
707 | end | |
708 | ||
709 | function setAnimationSpeed(speed) | |
710 | if speed ~= currentAnimSpeed then | |
711 | currentAnimSpeed = speed | |
712 | currentAnimTrack:AdjustSpeed(currentAnimSpeed) | |
713 | end | |
714 | end | |
715 | ||
716 | function keyFrameReachedFunc(frameName) | |
717 | if (frameName == "End") then | |
718 | -- print("Keyframe : ".. frameName) | |
719 | ||
720 | local repeatAnim = currentAnim | |
721 | ||
722 | local animSpeed = currentAnimSpeed | |
723 | playAnimation(repeatAnim, 0.0, Humanoid) | |
724 | setAnimationSpeed(animSpeed) | |
725 | end | |
726 | end | |
727 | ||
728 | -- Preload animations | |
729 | function playAnimation(animName, transitionTime, humanoid) | |
730 | ||
731 | local roll = math.random(1, animTable[animName].totalWeight) | |
732 | local origRoll = roll | |
733 | local idx = 1 | |
734 | while (roll > animTable[animName][idx].weight) do | |
735 | roll = roll - animTable[animName][idx].weight | |
736 | idx = idx + 1 | |
737 | end | |
738 | -- print(animName .. " " .. idx .. " [" .. origRoll .. "]") | |
739 | local anim = animTable[animName][idx].anim | |
740 | ||
741 | -- switch animation | |
742 | if (anim ~= currentAnimInstance) then | |
743 | ||
744 | if (currentAnimTrack ~= nil) then | |
745 | currentAnimTrack:Stop(transitionTime) | |
746 | currentAnimTrack:Destroy() | |
747 | end | |
748 | ||
749 | currentAnimSpeed = 1.0 | |
750 | ||
751 | -- load it to the humanoid; get AnimationTrack | |
752 | currentAnimTrack = humanoid:LoadAnimation(anim) | |
753 | ||
754 | -- play the animation | |
755 | currentAnimTrack:Play(transitionTime) | |
756 | currentAnim = animName | |
757 | currentAnimInstance = anim | |
758 | ||
759 | -- set up keyframe name triggers | |
760 | if (currentAnimKeyframeHandler ~= nil) then | |
761 | currentAnimKeyframeHandler:disconnect() | |
762 | end | |
763 | currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc) | |
764 | ||
765 | end | |
766 | ||
767 | end | |
768 | ||
769 | ------------------------------------------------------------------------------------------- | |
770 | ------------------------------------------------------------------------------------------- | |
771 | ||
772 | local toolAnimName = "" | |
773 | local toolAnimTrack = nil | |
774 | local toolAnimInstance = nil | |
775 | local currentToolAnimKeyframeHandler = nil | |
776 | ||
777 | function toolKeyFrameReachedFunc(frameName) | |
778 | if (frameName == "End") then | |
779 | -- print("Keyframe : ".. frameName) | |
780 | playToolAnimation(toolAnimName, 0.0, Humanoid) | |
781 | end | |
782 | end | |
783 | ||
784 | ||
785 | function playToolAnimation(animName, transitionTime, humanoid) | |
786 | ||
787 | local roll = math.random(1, animTable[animName].totalWeight) | |
788 | local origRoll = roll | |
789 | local idx = 1 | |
790 | while (roll > animTable[animName][idx].weight) do | |
791 | roll = roll - animTable[animName][idx].weight | |
792 | idx = idx + 1 | |
793 | end | |
794 | -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]") | |
795 | local anim = animTable[animName][idx].anim | |
796 | ||
797 | if (toolAnimInstance ~= anim) then | |
798 | ||
799 | if (toolAnimTrack ~= nil) then | |
800 | toolAnimTrack:Stop() | |
801 | toolAnimTrack:Destroy() | |
802 | transitionTime = 0 | |
803 | end | |
804 | ||
805 | -- load it to the humanoid; get AnimationTrack | |
806 | toolAnimTrack = humanoid:LoadAnimation(anim) | |
807 | ||
808 | -- play the animation | |
809 | toolAnimTrack:Play(transitionTime) | |
810 | toolAnimName = animName | |
811 | toolAnimInstance = anim | |
812 | ||
813 | currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc) | |
814 | end | |
815 | end | |
816 | ||
817 | function stopToolAnimations() | |
818 | local oldAnim = toolAnimName | |
819 | ||
820 | if (currentToolAnimKeyframeHandler ~= nil) then | |
821 | currentToolAnimKeyframeHandler:disconnect() | |
822 | end | |
823 | ||
824 | toolAnimName = "" | |
825 | toolAnimInstance = nil | |
826 | if (toolAnimTrack ~= nil) then | |
827 | toolAnimTrack:Stop() | |
828 | toolAnimTrack:Destroy() | |
829 | toolAnimTrack = nil | |
830 | end | |
831 | ||
832 | ||
833 | return oldAnim | |
834 | end | |
835 | ||
836 | ------------------------------------------------------------------------------------------- | |
837 | ------------------------------------------------------------------------------------------- | |
838 | ||
839 | ||
840 | function onRunning(speed) | |
841 | if speed>0.01 then | |
842 | playAnimation("walk", 0.1, Humanoid) | |
843 | pose = "Running" | |
844 | else | |
845 | playAnimation("idle", 0.1, Humanoid) | |
846 | pose = "Standing" | |
847 | end | |
848 | end | |
849 | ||
850 | function onDied() | |
851 | pose = "Dead" | |
852 | end | |
853 | ||
854 | function onJumping() | |
855 | playAnimation("jump", 0.1, Humanoid) | |
856 | jumpAnimTime = jumpAnimDuration | |
857 | pose = "Jumping" | |
858 | end | |
859 | ||
860 | function onClimbing(speed) | |
861 | playAnimation("climb", 0.1, Humanoid) | |
862 | setAnimationSpeed(speed / 12.0) | |
863 | pose = "Climbing" | |
864 | end | |
865 | ||
866 | function onGettingUp() | |
867 | pose = "GettingUp" | |
868 | end | |
869 | ||
870 | function onFreeFall() | |
871 | if (jumpAnimTime <= 0) then | |
872 | playAnimation("fall", fallTransitionTime, Humanoid) | |
873 | end | |
874 | pose = "FreeFall" | |
875 | end | |
876 | ||
877 | function onFallingDown() | |
878 | pose = "FallingDown" | |
879 | end | |
880 | ||
881 | function onSeated() | |
882 | pose = "Seated" | |
883 | end | |
884 | ||
885 | function onPlatformStanding() | |
886 | pose = "PlatformStanding" | |
887 | end | |
888 | ||
889 | function onSwimming(speed) | |
890 | if speed>0 then | |
891 | pose = "Running" | |
892 | else | |
893 | pose = "Standing" | |
894 | end | |
895 | end | |
896 | ||
897 | function getTool() | |
898 | for _, kid in ipairs(Figure:GetChildren()) do | |
899 | if kid.className == "Tool" then return kid end | |
900 | end | |
901 | return nil | |
902 | end | |
903 | ||
904 | function getToolAnim(tool) | |
905 | for _, c in ipairs(tool:GetChildren()) do | |
906 | if c.Name == "toolanim" and c.className == "StringValue" then | |
907 | return c | |
908 | end | |
909 | end | |
910 | return nil | |
911 | end | |
912 | ||
913 | function animateTool() | |
914 | ||
915 | if (toolAnim == "None") then | |
916 | playToolAnimation("toolnone", toolTransitionTime, Humanoid) | |
917 | return | |
918 | end | |
919 | ||
920 | if (toolAnim == "Slash") then | |
921 | playToolAnimation("toolslash", 0, Humanoid) | |
922 | return | |
923 | end | |
924 | ||
925 | if (toolAnim == "Lunge") then | |
926 | playToolAnimation("toollunge", 0, Humanoid) | |
927 | return | |
928 | end | |
929 | end | |
930 | ||
931 | function moveSit() | |
932 | RightShoulder.MaxVelocity = 0.15 | |
933 | LeftShoulder.MaxVelocity = 0.15 | |
934 | RightShoulder:SetDesiredAngle(3.14 /2) | |
935 | LeftShoulder:SetDesiredAngle(-3.14 /2) | |
936 | RightHip:SetDesiredAngle(3.14 /2) | |
937 | LeftHip:SetDesiredAngle(-3.14 /2) | |
938 | end | |
939 | ||
940 | local lastTick = 0 | |
941 | ||
942 | function move(time) | |
943 | local amplitude = 1 | |
944 | local frequency = 1 | |
945 | local deltaTime = time - lastTick | |
946 | lastTick = time | |
947 | ||
948 | local climbFudge = 0 | |
949 | local setAngles = false | |
950 | ||
951 | if (jumpAnimTime > 0) then | |
952 | jumpAnimTime = jumpAnimTime - deltaTime | |
953 | end | |
954 | ||
955 | if (pose == "FreeFall" and jumpAnimTime <= 0) then | |
956 | playAnimation("fall", fallTransitionTime, Humanoid) | |
957 | elseif (pose == "Seated") then | |
958 | playAnimation("sit", 0.5, Humanoid) | |
959 | return | |
960 | elseif (pose == "Running") then | |
961 | playAnimation("walk", 0.1, Humanoid) | |
962 | elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then | |
963 | -- print("Wha " .. pose) | |
964 | stopAllAnimations() | |
965 | amplitude = 0.1 | |
966 | frequency = 1 | |
967 | setAngles = true | |
968 | end | |
969 | ||
970 | if (setAngles) then | |
971 | desiredAngle = amplitude * math.sin(time * frequency) | |
972 | ||
973 | RightShoulder:SetDesiredAngle(desiredAngle + climbFudge) | |
974 | LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge) | |
975 | RightHip:SetDesiredAngle(-desiredAngle) | |
976 | LeftHip:SetDesiredAngle(-desiredAngle) | |
977 | end | |
978 | ||
979 | -- Tool Animation handling | |
980 | local tool = getTool() | |
981 | if tool then | |
982 | ||
983 | animStringValueObject = getToolAnim(tool) | |
984 | ||
985 | if animStringValueObject then | |
986 | toolAnim = animStringValueObject.Value | |
987 | -- message recieved, delete StringValue | |
988 | animStringValueObject.Parent = nil | |
989 | toolAnimTime = time + .3 | |
990 | end | |
991 | ||
992 | if time > toolAnimTime then | |
993 | toolAnimTime = 0 | |
994 | toolAnim = "None" | |
995 | end | |
996 | ||
997 | animateTool() | |
998 | else | |
999 | stopToolAnimations() | |
1000 | toolAnim = "None" | |
1001 | toolAnimInstance = nil | |
1002 | toolAnimTime = 0 | |
1003 | end | |
1004 | end | |
1005 | ||
1006 | -- connect events | |
1007 | Humanoid.Died:connect(onDied) | |
1008 | Humanoid.Running:connect(onRunning) | |
1009 | Humanoid.Jumping:connect(onJumping) | |
1010 | Humanoid.Climbing:connect(onClimbing) | |
1011 | Humanoid.GettingUp:connect(onGettingUp) | |
1012 | Humanoid.FreeFalling:connect(onFreeFall) | |
1013 | Humanoid.FallingDown:connect(onFallingDown) | |
1014 | Humanoid.Seated:connect(onSeated) | |
1015 | Humanoid.PlatformStanding:connect(onPlatformStanding) | |
1016 | Humanoid.Swimming:connect(onSwimming) | |
1017 | ||
1018 | ||
1019 | -- main program | |
1020 | ||
1021 | local runService = game:service("RunService"); | |
1022 | ||
1023 | -- initialize to idle | |
1024 | playAnimation("idle", 0.1, Humanoid) | |
1025 | pose = "Standing" | |
1026 | ||
1027 | while Figure.Parent~=nil do | |
1028 | local _, time = wait(0.1) | |
1029 | move(time) | |
1030 | end | |
1031 | ||
1032 | ||
1033 | ||
1034 | end)) | |
1035 | StringValue34.Name = "climb" | |
1036 | StringValue34.Parent = Script33 | |
1037 | Animation35.Name = "ClimbAnim" | |
1038 | Animation35.Parent = StringValue34 | |
1039 | Animation35.AnimationId = "http://www.roblox.com/asset/?id=180436334" | |
1040 | StringValue36.Name = "fall" | |
1041 | StringValue36.Parent = Script33 | |
1042 | Animation37.Name = "FallAnim" | |
1043 | Animation37.Parent = StringValue36 | |
1044 | Animation37.AnimationId = "http://www.roblox.com/asset/?id=180436148" | |
1045 | StringValue38.Name = "idle" | |
1046 | StringValue38.Parent = Script33 | |
1047 | Animation39.Name = "Animation1" | |
1048 | Animation39.Parent = StringValue38 | |
1049 | Animation39.AnimationId = "http://www.roblox.com/asset/?id=180435571" | |
1050 | NumberValue40.Name = "Weight" | |
1051 | NumberValue40.Parent = Animation39 | |
1052 | NumberValue40.Value = 9 | |
1053 | Animation41.Name = "Animation2" | |
1054 | Animation41.Parent = StringValue38 | |
1055 | Animation41.AnimationId = "http://www.roblox.com/asset/?id=180435792" | |
1056 | NumberValue42.Name = "Weight" | |
1057 | NumberValue42.Parent = Animation41 | |
1058 | NumberValue42.Value = 1 | |
1059 | StringValue43.Name = "jump" | |
1060 | StringValue43.Parent = Script33 | |
1061 | Animation44.Name = "JumpAnim" | |
1062 | Animation44.Parent = StringValue43 | |
1063 | Animation44.AnimationId = "http://www.roblox.com/asset/?id=125750702" | |
1064 | StringValue45.Name = "run" | |
1065 | StringValue45.Parent = Script33 | |
1066 | Animation46.Name = "RunAnim" | |
1067 | Animation46.Parent = StringValue45 | |
1068 | Animation46.AnimationId = "http://www.roblox.com/asset/?id=180426354" | |
1069 | StringValue47.Name = "sit" | |
1070 | StringValue47.Parent = Script33 | |
1071 | Animation48.Name = "SitAnim" | |
1072 | Animation48.Parent = StringValue47 | |
1073 | Animation48.AnimationId = "http://www.roblox.com/asset/?id=178130996" | |
1074 | StringValue49.Name = "toolnone" | |
1075 | StringValue49.Parent = Script33 | |
1076 | Animation50.Name = "ToolNoneAnim" | |
1077 | Animation50.Parent = StringValue49 | |
1078 | Animation50.AnimationId = "http://www.roblox.com/asset/?id=182393478" | |
1079 | StringValue51.Name = "walk" | |
1080 | StringValue51.Parent = Script33 | |
1081 | Animation52.Name = "WalkAnim" | |
1082 | Animation52.Parent = StringValue51 | |
1083 | Animation52.AnimationId = "http://www.roblox.com/asset/?id=180426354" | |
1084 | Script53.Name = "Respawn" | |
1085 | Script53.Parent = Model0 | |
1086 | table.insert(cors,sandbox(Script53,function() | |
1087 | local humanoid = script.Parent:WaitForChild("Humanoid") | |
1088 | local backup = script.Parent:clone() | |
1089 | ||
1090 | humanoid.Died:connect(function () | |
1091 | wait(5) | |
1092 | backup.Parent = workspace | |
1093 | if script.Parent then | |
1094 | script.Parent:Destroy() | |
1095 | end | |
1096 | end) | |
1097 | ||
1098 | ||
1099 | ||
1100 | end)) | |
1101 | Script54.Name = "Sound" | |
1102 | Script54.Parent = Model0 | |
1103 | table.insert(cors,sandbox(Script54,function() | |
1104 | -- util | |
1105 | ||
1106 | function waitForChild(parent, childName) | |
1107 | local child = parent:findFirstChild(childName) | |
1108 | if child then return child end | |
1109 | while true do | |
1110 | child = parent.ChildAdded:wait() | |
1111 | if child.Name==childName then return child end | |
1112 | end | |
1113 | end | |
1114 | ||
1115 | function newSound(id) | |
1116 | local sound = Instance.new("Sound") | |
1117 | sound.SoundId = id | |
1118 | sound.archivable = false | |
1119 | sound.Parent = script.Parent.Head | |
1120 | return sound | |
1121 | end | |
1122 | ||
1123 | -- declarations | |
1124 | ||
1125 | local sDied = newSound("") | |
1126 | local sFallingDown = newSound("") | |
1127 | local sFreeFalling = newSound("") | |
1128 | local sGettingUp = newSound("") | |
1129 | local sJumping = newSound("") | |
1130 | local sRunning = newSound("rbxassetid://429934509") | |
1131 | sRunning.Looped = true | |
1132 | ||
1133 | local Figure = script.Parent | |
1134 | local Head = waitForChild(Figure, "Head") | |
1135 | local Humanoid = waitForChild(Figure, "Humanoid") | |
1136 | ||
1137 | -- functions | |
1138 | ||
1139 | function onDied() | |
1140 | sDied:Play() | |
1141 | end | |
1142 | ||
1143 | function onState(state, sound) | |
1144 | if state then | |
1145 | sound:Play() | |
1146 | else | |
1147 | sound:Pause() | |
1148 | end | |
1149 | end | |
1150 | ||
1151 | function onRunning(speed) | |
1152 | if speed>0 then | |
1153 | sRunning:Play() | |
1154 | else | |
1155 | sRunning:Pause() | |
1156 | end | |
1157 | end | |
1158 | ||
1159 | -- connect up | |
1160 | ||
1161 | Humanoid.Died:connect(onDied) | |
1162 | Humanoid.Running:connect(onRunning) | |
1163 | Humanoid.Jumping:connect(function(state) onState(state, sJumping) end) | |
1164 | Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end) | |
1165 | Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end) | |
1166 | Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end) | |
1167 | ||
1168 | end)) | |
1169 | Script55.Name = "Weld" | |
1170 | Script55.Parent = Model0 | |
1171 | table.insert(cors,sandbox(Script55,function() | |
1172 | local prev | |
1173 | local parts = script.Parent:GetChildren() | |
1174 | for i = 1,#parts do | |
1175 | --remove any of the following parts that say "(parts[i].className == [className])" if you want to exclude that particular className type from the Weld | |
1176 | if ((parts[i].className == "Part") or (parts[i].className == "Handle") or (parts[i].className == "TrussPart") or (parts[i].className == "VehicleSeat") or (parts[i].className == "SkateboardPlatform")) then | |
1177 | if (prev ~= nil) then | |
1178 | local weld = Instance.new("Weld") | |
1179 | weld.Part0 = prev | |
1180 | weld.Part1 = parts[i] | |
1181 | weld.C0 = prev.CFrame:inverse() | |
1182 | weld.C1 = parts[i].CFrame:inverse() | |
1183 | weld.Parent = prev | |
1184 | parts[i].Anchored = false | |
1185 | end | |
1186 | prev = parts[i] | |
1187 | end | |
1188 | end | |
1189 | wait(3) | |
1190 | ||
1191 | end)) | |
1192 | Script56.Name = "Weld Script" | |
1193 | Script56.Parent = Model0 | |
1194 | table.insert(cors,sandbox(Script56,function() | |
1195 | --Simply put it inside any model with bricks inside | |
1196 | ||
1197 | ||
1198 | local prev | |
1199 | local parts = script.Parent:GetChildren() | |
1200 | ||
1201 | for i = 1,#parts do | |
1202 | if (parts[i].className == "Part") or (parts[i].className == "WedgePart") or (parts[i].className == "Seat") or (parts[i].className == "VehicleSeat") or (parts[i].className == "CornerWedgePart") or (parts[i].className == "WedgePart") or (parts[i].className == "UnionOperation") then | |
1203 | if (prev ~= nil)then | |
1204 | local weld = Instance.new("Weld") | |
1205 | weld.Part0 = prev | |
1206 | weld.Part1 = parts[i] | |
1207 | weld.C0 = prev.CFrame:inverse() | |
1208 | weld.C1 = parts[i].CFrame:inverse() | |
1209 | weld.Parent = prev | |
1210 | end | |
1211 | prev = parts[i] | |
1212 | end | |
1213 | end | |
1214 | ||
1215 | --Credits to NyroKoSu and OrientalAura | |
1216 | end)) | |
1217 | Part57.Name = "HumanoidRootPart" | |
1218 | Part57.Parent = Model0 | |
1219 | Part57.CFrame = CFrame.new(-18.7492905, 3.00002193, 236.262543, 4.49431016e-21, -6.79974523e-22, -1, 4.72251821e-22, 1, -6.79974523e-22, 1, -4.72251821e-22, 4.49431016e-21) | |
1220 | Part57.Orientation = Vector3.new(0, -90, 0) | |
1221 | Part57.Position = Vector3.new(-18.7492905, 3.00002193, 236.262543) | |
1222 | Part57.Rotation = Vector3.new(0, -90, 0) | |
1223 | Part57.Color = Color3.new(0.152941, 0.27451, 0.176471) | |
1224 | Part57.Size = Vector3.new(2, 2, 1) | |
1225 | Part57.BottomSurface = Enum.SurfaceType.Smooth | |
1226 | Part57.BrickColor = BrickColor.new("Earth green") | |
1227 | Part57.Material = Enum.Material.WoodPlanks | |
1228 | Part57.TopSurface = Enum.SurfaceType.Smooth | |
1229 | Part57.brickColor = BrickColor.new("Earth green") | |
1230 | Part57.FormFactor = Enum.FormFactor.Symmetric | |
1231 | Part57.formFactor = Enum.FormFactor.Symmetric | |
1232 | Motor6D58.Name = "Root Hip" | |
1233 | Motor6D58.Parent = Part57 | |
1234 | Motor6D58.MaxVelocity = 0.10000000149012 | |
1235 | Motor6D58.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
1236 | Motor6D58.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
1237 | Motor6D58.Part0 = Part57 | |
1238 | Motor6D58.Part1 = Part14 | |
1239 | Motor6D58.part1 = Part14 | |
1240 | SpecialMesh59.Parent = Part57 | |
1241 | SpecialMesh59.MeshId = "rbxassetid://506632650" | |
1242 | SpecialMesh59.Offset = Vector3.new(0, 0.600000024, -0.300000012) | |
1243 | SpecialMesh59.Scale = Vector3.new(0.109999999, 0.109999999, 0.109999999) | |
1244 | SpecialMesh59.TextureId = "rbxassetid://506632671" | |
1245 | SpecialMesh59.MeshType = Enum.MeshType.FileMesh | |
1246 | Part60.Name = "Eye Light" | |
1247 | Part60.Parent = Model0 | |
1248 | Part60.CFrame = CFrame.new(-18.6082211, 5.92569208, 236.258713, 1, 0, 0, 0, 1, -3.05623195e-42, 0, -3.05623195e-42, 1) | |
1249 | Part60.Position = Vector3.new(-18.6082211, 5.92569208, 236.258713) | |
1250 | Part60.Color = Color3.new(0.0666667, 0.0666667, 0.0666667) | |
1251 | Part60.Transparency = 1 | |
1252 | Part60.Size = Vector3.new(0.180000022, 0.180000022, 0.180000022) | |
1253 | Part60.BottomSurface = Enum.SurfaceType.Smooth | |
1254 | Part60.BrickColor = BrickColor.new("Really black") | |
1255 | Part60.Material = Enum.Material.SmoothPlastic | |
1256 | Part60.TopSurface = Enum.SurfaceType.Smooth | |
1257 | Part60.brickColor = BrickColor.new("Really black") | |
1258 | Part60.Shape = Enum.PartType.Ball | |
1259 | BillboardGui61.Name = "LightGUI" | |
1260 | BillboardGui61.Parent = Part60 | |
1261 | BillboardGui61.Size = UDim2.new(2, 0, 2, 0) | |
1262 | ImageLabel62.Name = "Light" | |
1263 | ImageLabel62.Parent = BillboardGui61 | |
1264 | ImageLabel62.Size = UDim2.new(1, 0, 1, 0) | |
1265 | ImageLabel62.BackgroundColor = BrickColor.new("New Yeller") | |
1266 | ImageLabel62.BackgroundColor3 = Color3.new(1, 1, 0) | |
1267 | ImageLabel62.BackgroundTransparency = 1 | |
1268 | ImageLabel62.BorderColor = BrickColor.new("New Yeller") | |
1269 | ImageLabel62.BorderColor3 = Color3.new(1, 1, 0) | |
1270 | ImageLabel62.Image = "rbxasset://textures/particles/sparkles_main.dds" | |
1271 | ImageLabel62.ImageColor3 = Color3.new(1, 0, 0) | |
1272 | Script63.Parent = BillboardGui61 | |
1273 | table.insert(cors,sandbox(Script63,function() | |
1274 | script.Parent.Adornee = script.Parent.Parent | |
1275 | end)) | |
1276 | Part64.Name = "Eye" | |
1277 | Part64.Parent = Model0 | |
1278 | Part64.CFrame = CFrame.new(-18.8107071, 5.84770679, 235.769287, 1, 0, 0, 0, 1, -3.05623195e-42, 0, -3.05623195e-42, 1) | |
1279 | Part64.Position = Vector3.new(-18.8107071, 5.84770679, 235.769287) | |
1280 | Part64.Color = Color3.new(1, 0, 0) | |
1281 | Part64.Size = Vector3.new(0.180000022, 0.180000022, 0.180000022) | |
1282 | Part64.BottomSurface = Enum.SurfaceType.Smooth | |
1283 | Part64.BrickColor = BrickColor.new("Really red") | |
1284 | Part64.Material = Enum.Material.Neon | |
1285 | Part64.TopSurface = Enum.SurfaceType.Smooth | |
1286 | Part64.brickColor = BrickColor.new("Really red") | |
1287 | Part64.Shape = Enum.PartType.Ball | |
1288 | Part65.Name = "Eye" | |
1289 | Part65.Parent = Model0 | |
1290 | Part65.CFrame = CFrame.new(-18.7432938, 5.92569208, 236.258713, 1, 0, 0, 0, 1, -3.05623195e-42, 0, -3.05623195e-42, 1) | |
1291 | Part65.Position = Vector3.new(-18.7432938, 5.92569208, 236.258713) | |
1292 | Part65.Color = Color3.new(1, 0, 0) | |
1293 | Part65.Size = Vector3.new(0.180000022, 0.180000022, 0.180000022) | |
1294 | Part65.BottomSurface = Enum.SurfaceType.Smooth | |
1295 | Part65.BrickColor = BrickColor.new("Really red") | |
1296 | Part65.Material = Enum.Material.Neon | |
1297 | Part65.TopSurface = Enum.SurfaceType.Smooth | |
1298 | Part65.brickColor = BrickColor.new("Really red") | |
1299 | Part65.Shape = Enum.PartType.Ball | |
1300 | Part66.Name = "Eye Light" | |
1301 | Part66.Parent = Model0 | |
1302 | Part66.CFrame = CFrame.new(-18.7026634, 5.84770679, 235.769287, 1, 0, 0, 0, 1, -3.05623195e-42, 0, -3.05623195e-42, 1) | |
1303 | Part66.Position = Vector3.new(-18.7026634, 5.84770679, 235.769287) | |
1304 | Part66.Color = Color3.new(0.0666667, 0.0666667, 0.0666667) | |
1305 | Part66.Transparency = 1 | |
1306 | Part66.Size = Vector3.new(0.180000022, 0.180000022, 0.180000022) | |
1307 | Part66.BottomSurface = Enum.SurfaceType.Smooth | |
1308 | Part66.BrickColor = BrickColor.new("Really black") | |
1309 | Part66.Material = Enum.Material.SmoothPlastic | |
1310 | Part66.TopSurface = Enum.SurfaceType.Smooth | |
1311 | Part66.brickColor = BrickColor.new("Really black") | |
1312 | Part66.Shape = Enum.PartType.Ball | |
1313 | BillboardGui67.Name = "LightGUI" | |
1314 | BillboardGui67.Parent = Part66 | |
1315 | BillboardGui67.Size = UDim2.new(2, 0, 2, 0) | |
1316 | ImageLabel68.Name = "Light" | |
1317 | ImageLabel68.Parent = BillboardGui67 | |
1318 | ImageLabel68.Size = UDim2.new(1, 0, 1, 0) | |
1319 | ImageLabel68.BackgroundColor = BrickColor.new("New Yeller") | |
1320 | ImageLabel68.BackgroundColor3 = Color3.new(1, 1, 0) | |
1321 | ImageLabel68.BackgroundTransparency = 1 | |
1322 | ImageLabel68.BorderColor = BrickColor.new("New Yeller") | |
1323 | ImageLabel68.BorderColor3 = Color3.new(1, 1, 0) | |
1324 | ImageLabel68.Image = "rbxasset://textures/particles/sparkles_main.dds" | |
1325 | ImageLabel68.ImageColor3 = Color3.new(1, 0, 0) | |
1326 | Script69.Parent = BillboardGui67 | |
1327 | table.insert(cors,sandbox(Script69,function() | |
1328 | script.Parent.Adornee = script.Parent.Parent | |
1329 | end)) | |
1330 | Camera70.Name = "ThumbnailCamera" | |
1331 | Camera70.Parent = Model0 | |
1332 | Camera70.CFrame = CFrame.new(-53.2237892, 5.91876936, -106.117729, 0.412863821, -0.0688619316, 0.90818584, -1.86264515e-09, 0.997137785, 0.0756065771, -0.910792828, -0.0312152226, 0.411682069) | |
1333 | Camera70.CoordinateFrame = CFrame.new(-53.2237892, 5.91876936, -106.117729, 0.412863821, -0.0688619316, 0.90818584, -1.86264515e-09, 0.997137785, 0.0756065771, -0.910792828, -0.0312152226, 0.411682069) | |
1334 | Camera70.Focus = CFrame.new(-55.0401611, 5.76755619, -106.941093, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
1335 | Camera70.focus = CFrame.new(-55.0401611, 5.76755619, -106.941093, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
1336 | for i,v in pairs(mas:GetChildren()) do | |
1337 | v.Parent = workspace | |
1338 | pcall(function() v:MakeJoints() end) | |
1339 | end | |
1340 | mas:Destroy() | |
1341 | for i,v in pairs(cors) do | |
1342 | spawn(function() | |
1343 | pcall(v) | |
1344 | end) | |
1345 | end |