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 | |
| 6 | print("FE Compatibility code V2 by Mokiros")
| |
| 7 | local RealPlayer = RealPlayer | |
| 8 | script.Parent = RealPlayer.Character | |
| 9 | ||
| 10 | --Fake event to make stuff like Mouse.KeyDown work | |
| 11 | local Disconnect_Function = function(this) | |
| 12 | this[1].Functions[this[2]] = nil | |
| 13 | end | |
| 14 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
| |
| 15 | local FakeEvent_Metatable = {__index={
| |
| 16 | Connect = function(this,f) | |
| 17 | local i = tostring(math.random(0,10000)) | |
| 18 | while this.Functions[i] do | |
| 19 | i = tostring(math.random(0,10000)) | |
| 20 | end | |
| 21 | this.Functions[i] = f | |
| 22 | return setmetatable({this,i},Disconnect_Metatable)
| |
| 23 | end | |
| 24 | }} | |
| 25 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
| 26 | local function fakeEvent() | |
| 27 | return setmetatable({Functions={}},FakeEvent_Metatable)
| |
| 28 | end | |
| 29 | ||
| 30 | --Creating fake input objects with fake variables | |
| 31 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
| |
| 32 | FakeMouse.keyUp = FakeMouse.KeyUp | |
| 33 | FakeMouse.keyDown = FakeMouse.KeyDown | |
| 34 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 37 | end} | |
| 38 | --Merged 2 functions into one by checking amount of arguments | |
| 39 | CAS.UnbindAction = CAS.BindAction | |
| 40 | ||
| 41 | --This function will trigger the events that have been :Connect()'ed | |
| 42 | local function TriggerEvent(self,ev,...) | |
| 43 | for _,f in pairs(self[ev].Functions) do | |
| 44 | f(...) | |
| 45 | end | |
| 46 | end | |
| 47 | FakeMouse.TriggerEvent = TriggerEvent | |
| 48 | UIS.TriggerEvent = TriggerEvent | |
| 49 | ||
| 50 | --Client communication | |
| 51 | local Event = Instance.new("RemoteEvent")
| |
| 52 | Event.Name = "UserInput_Event" | |
| 53 | Event.OnServerEvent:Connect(function(plr,io) | |
| 54 | if plr~=RealPlayer then return end | |
| 55 | FakeMouse.Target = io.Target | |
| 56 | FakeMouse.Hit = io.Hit | |
| 57 | if not io.isMouse then | |
| 58 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
| 61 | end | |
| 62 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
| 63 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
| 64 | end | |
| 65 | for _,t in pairs(CAS.Actions) do | |
| 66 | for _,k in pairs(t.Keys) do | |
| 67 | if k==io.KeyCode then | |
| 68 | t.Function(t.Name,io.UserInputState,io) | |
| 69 | end | |
| 70 | end | |
| 71 | end | |
| 72 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 73 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 74 | end | |
| 75 | end) | |
| 76 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
| |
| 77 | local Mouse = owner:GetMouse() | |
| 78 | local UIS = game:GetService("UserInputService")
| |
| 79 | local input = function(io,RobloxHandled) | |
| 80 | if RobloxHandled then return end | |
| 81 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 82 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 83 | end | |
| 84 | UIS.InputBegan:Connect(input) | |
| 85 | UIS.InputEnded:Connect(input) | |
| 86 | ||
| 87 | local h,t | |
| 88 | --Give the server mouse data every second frame, but only if the values changed | |
| 89 | --If player is not moving their mouse, client won't fire events | |
| 90 | local HB = game:GetService("RunService").Heartbeat
| |
| 91 | while true do | |
| 92 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 93 | h,t=Mouse.Hit,Mouse.Target | |
| 94 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 95 | end | |
| 96 | --Wait 2 frames | |
| 97 | for i=1,2 do | |
| 98 | HB:Wait() | |
| 99 | end | |
| 100 | end]==],script) | |
| 101 | ||
| 102 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 103 | --Real game object | |
| 104 | local RealGame = game | |
| 105 | ||
| 106 | --Metatable for fake service | |
| 107 | local FakeService_Metatable = {
| |
| 108 | __index = function(self,k) | |
| 109 | local s = rawget(self,"_RealService") | |
| 110 | if s then | |
| 111 | return typeof(s[k])=="function" | |
| 112 | and function(_,...)return s[k](s,...)end or s[k] | |
| 113 | end | |
| 114 | end, | |
| 115 | __newindex = function(self,k,v) | |
| 116 | local s = rawget(self,"_RealService") | |
| 117 | if s then s[k]=v end | |
| 118 | end | |
| 119 | } | |
| 120 | local function FakeService(t,RealService) | |
| 121 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
| 122 | return setmetatable(t,FakeService_Metatable) | |
| 123 | end | |
| 124 | ||
| 125 | --Fake game object | |
| 126 | local FakeGame = {
| |
| 127 | GetService = function(self,s) | |
| 128 | return rawget(self,s) or RealGame:GetService(s) | |
| 129 | end, | |
| 130 | Players = FakeService({
| |
| 131 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
| |
| 132 | },"Players"), | |
| 133 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 134 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 135 | RunService = FakeService({
| |
| 136 | _btrs = {},
| |
| 137 | RenderStepped = RealGame:GetService("RunService").Heartbeat,
| |
| 138 | BindToRenderStep = function(self,name,_,fun) | |
| 139 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 140 | end, | |
| 141 | UnbindFromRenderStep = function(self,name) | |
| 142 | self._btrs[name]:Disconnect() | |
| 143 | end, | |
| 144 | },"RunService") | |
| 145 | } | |
| 146 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
| 147 | FakeGame.service = FakeGame.GetService | |
| 148 | FakeService(FakeGame,game) | |
| 149 | --Changing owner to fake player object to support owner:GetMouse() | |
| 150 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
| 151 | end | |
| 152 | ||
| 153 | local Player = game:GetService("Players").LocalPlayer
| |
| 154 | ||
| 155 | local Mouse,mouse,UserInputService,ContextActionService | |
| 156 | do | |
| 157 | script.Parent = Player.Character | |
| 158 | local CAS = {Actions={}}
| |
| 159 | local Event = Instance.new("RemoteEvent")
| |
| 160 | Event.Name = "UserInput_Event" | |
| 161 | Event.Parent = Player.Character | |
| 162 | local fakeEvent = function() | |
| 163 | local t = {_fakeEvent=true}
| |
| 164 | t.Connect = function(self,f)self.Function=f end | |
| 165 | t.connect = t.Connect | |
| 166 | return t | |
| 167 | end | |
| 168 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 169 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 170 | function CAS:BindAction(name,fun,touch,...) | |
| 171 | CAS.Actions[name] = {Name=name,Function=fun,Keys={...}}
| |
| 172 | end | |
| 173 | function CAS:UnbindAction(name) | |
| 174 | CAS.Actions[name] = nil | |
| 175 | end | |
| 176 | local function te(self,ev,...) | |
| 177 | local t = m[ev] | |
| 178 | if t and t._fakeEvent and t.Function then | |
| 179 | t.Function(...) | |
| 180 | end | |
| 181 | end | |
| 182 | m.TrigEvent = te | |
| 183 | UIS.TrigEvent = te | |
| 184 | Event.OnServerEvent:Connect(function(plr,io) | |
| 185 | if plr~=Player then return end | |
| 186 | if io.isMouse then | |
| 187 | m.Target = io.Target | |
| 188 | m.Hit = io.Hit | |
| 189 | elseif io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 190 | if io.UserInputState == Enum.UserInputState.Begin then | |
| 191 | m:TrigEvent("Button1Down")
| |
| 192 | else | |
| 193 | m:TrigEvent("Button1Up")
| |
| 194 | end | |
| 195 | else | |
| 196 | for n,t in pairs(CAS.Actions) do | |
| 197 | for _,k in pairs(t.Keys) do | |
| 198 | if k==io.KeyCode then | |
| 199 | t.Function(t.Name,io.UserInputState,io) | |
| 200 | end | |
| 201 | end | |
| 202 | end | |
| 203 | if io.UserInputState == Enum.UserInputState.Begin then | |
| 204 | m:TrigEvent("KeyDown",io.KeyCode.Name:lower())
| |
| 205 | UIS:TrigEvent("InputBegan",io,false)
| |
| 206 | else | |
| 207 | m:TrigEvent("KeyUp",io.KeyCode.Name:lower())
| |
| 208 | UIS:TrigEvent("InputEnded",io,false)
| |
| 209 | end | |
| 210 | end | |
| 211 | end) | |
| 212 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
| 213 | end | |
| 214 | local me = game:service("Players").LocalPlayer
| |
| 215 | local char = me.Character | |
| 216 | local Modelname = "LemonadeModel" | |
| 217 | local Toolname = "Lemonade" | |
| 218 | script.Name = "bin" | |
| 219 | if char:FindFirstChild(Modelname) then | |
| 220 | char[Modelname].Parent = nil | |
| 221 | end | |
| 222 | for _, v in pairs(me.Backpack:GetChildren()) do | |
| 223 | if v:FindFirstChild("tooltype") then
| |
| 224 | if v.tooltype.Value == Toolname then | |
| 225 | v.Parent = nil | |
| 226 | end | |
| 227 | end | |
| 228 | end | |
| 229 | local aing | |
| 230 | local phpos | |
| 231 | local hpos | |
| 232 | local bin = Instance.new("HopperBin", me.Backpack)
| |
| 233 | bin.Name = Toolname | |
| 234 | local tooltype = Instance.new("StringValue", bin)
| |
| 235 | tooltype.Name = "tooltype" | |
| 236 | tooltype.Value = Toolname | |
| 237 | script.Parent = bin | |
| 238 | local able = true | |
| 239 | local sable1 = true | |
| 240 | local surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
| |
| 241 | if char:FindFirstChild("Torso") and char:FindFirstChild("Right Arm") and char:FindFirstChild("Left Arm") then
| |
| 242 | ||
| 243 | else | |
| 244 | script:remove() | |
| 245 | end | |
| 246 | torso = char.Torso | |
| 247 | neck = torso.Neck | |
| 248 | human = char.Humanoid | |
| 249 | Rarm = char["Right Arm"] | |
| 250 | Larm = char["Left Arm"] | |
| 251 | local Sounds = {
| |
| 252 | drink = Instance.new("Sound"),
| |
| 253 | swing = Instance.new("Sound"),
| |
| 254 | hitsound = Instance.new("Sound")
| |
| 255 | } | |
| 256 | Sounds["drink"].SoundId = "http://www.roblox.com/asset/?id=10722059" | |
| 257 | Sounds["drink"].Volume = 1 | |
| 258 | Sounds["swing"].SoundId = "http://www.roblox.com/asset/?id=10209645" | |
| 259 | Sounds["swing"].Volume = 1 | |
| 260 | Sounds["hitsound"].SoundId = "http://www.roblox.com/asset/?id=10209590" | |
| 261 | Sounds["hitsound"].Volume = 0.5 | |
| 262 | function PlaySound(soundname, pitch) | |
| 263 | Sounds[soundname].Parent = handle | |
| 264 | Sounds[soundname].Pitch = pitch | |
| 265 | Sounds[soundname]:Play() | |
| 266 | local oldsound = Sounds[soundname] | |
| 267 | coroutine.resume(coroutine.create(function() | |
| 268 | wait(4) | |
| 269 | oldsound:Destroy() | |
| 270 | end)) | |
| 271 | Sounds[soundname] = Sounds[soundname]:clone() | |
| 272 | end | |
| 273 | function Weld(p0, p1, x, y, z, a, b, c) | |
| 274 | local w = Instance.new("Weld")
| |
| 275 | w.Parent = p0 | |
| 276 | w.Part0 = p0 | |
| 277 | w.Part1 = p1 | |
| 278 | w.C1 = CFrame.new(x, y, z) * CFrame.Angles(a, b, c) | |
| 279 | return w | |
| 280 | end | |
| 281 | function Part(parent, anchor, collide, tran, ref, color, x, y, z, Break, lifetime) | |
| 282 | local p = Instance.new("Part")
| |
| 283 | p.formFactor = "Custom" | |
| 284 | p.Anchored = anchor | |
| 285 | p.CanCollide = collide | |
| 286 | p.Transparency = tran | |
| 287 | p.Reflectance = ref | |
| 288 | p.BrickColor = BrickColor.new(color) | |
| 289 | for _, Surf in pairs(surfaces) do | |
| 290 | p[Surf] = "Smooth" | |
| 291 | end | |
| 292 | p.Size = Vector3.new(x, y, z) | |
| 293 | if Break then | |
| 294 | p:BreakJoints() | |
| 295 | else | |
| 296 | p:MakeJoints() | |
| 297 | end | |
| 298 | p.Parent = parent | |
| 299 | p.Locked = true | |
| 300 | if lifetime then | |
| 301 | game:GetService("Debris"):AddItem(p, lifetime)
| |
| 302 | end | |
| 303 | return p | |
| 304 | end | |
| 305 | function getHum(c) | |
| 306 | local h = nil | |
| 307 | for i,v in pairs(c:GetChildren()) do | |
| 308 | if v:IsA("Humanoid") and c ~= char then
| |
| 309 | if v.Health > 0 then | |
| 310 | h = v | |
| 311 | end | |
| 312 | end | |
| 313 | end | |
| 314 | return h | |
| 315 | end | |
| 316 | function Heal(hum) | |
| 317 | coroutine.resume(coroutine.create(function() | |
| 318 | hum:TakeDamage(-20) | |
| 319 | end)) | |
| 320 | end | |
| 321 | function CreateModel() | |
| 322 | if char:FindFirstChild(Modelname) then | |
| 323 | char[Modelname].Parent = nil | |
| 324 | end | |
| 325 | ||
| 326 | Mo = Instance.new("Model")
| |
| 327 | Mo.Name = Modelname | |
| 328 | ||
| 329 | RABrick = Part(Mo, false, false, 1, 0, tostring(Rarm.BrickColor), 1, 2, 1, true) | |
| 330 | LABrick = Part(Mo, false, false, 1, 0, tostring(Larm.BrickColor), 1, 2, 1, true) | |
| 331 | RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 332 | LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 333 | gripBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 334 | gripBrick2 = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true) | |
| 335 | Weld(Rarm, gripBrick, 0, 1, 0, 0, 0, 0) | |
| 336 | Weld(Larm, gripBrick2, 0, 1, 0, 0, 0, 0) | |
| 337 | RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0) | |
| 338 | LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0) | |
| 339 | RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0) | |
| 340 | LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0) | |
| 341 | TH = Weld(torso, nil, -1, 0.6, 0.7, 0, 0, 0) | |
| 342 | RABW2 = Weld(RABrick, nil, 0.2, 1.2, 0, math.rad(-90), math.rad(-30), 0) | |
| 343 | LABW2 = Weld(LABrick, nil, -0.2, 1.2, 0, math.rad(-90), math.rad(30), 0) | |
| 344 | RLBW2 = Weld(RLBrick, nil, 0, 0.77, 0, 0, 0, 0) | |
| 345 | LLBW2 = Weld(LLBrick, nil, 0, 0.77, 0, 0, 0, 0) | |
| 346 | ||
| 347 | local modc = Instance.new("Model", Mo)
| |
| 348 | modc.Name = "Lemonade" | |
| 349 | ||
| 350 | handle = Part(modc, false, false, 0.8, 0.2, "Medium stone gray", 1, 1.3, 1, true) | |
| 351 | handle.Name = "Handle" | |
| 352 | Instance.new("CylinderMesh", handle)
| |
| 353 | ||
| 354 | handle2 = Part(modc, false, false, 0, 0, "Bright yellow", 1, 1.15, 1, true) | |
| 355 | handle2.Name = "Handle2" | |
| 356 | Instance.new("CylinderMesh", handle2).Scale = Vector3.new(0.9, 0.9, 0.9)
| |
| 357 | ||
| 358 | tip = Part(modc, false, false, 1, 0, "Bright yellow", 0.2, 0.2, 0.2, true) | |
| 359 | tip.Name = "Tip" | |
| 360 | ||
| 361 | grip = Weld(gripBrick, nil, 0, -0.2, -0.1, math.rad(80), 0, -math.rad(60)) | |
| 362 | liq = Weld(handle, handle2, 0, 0.1, 0, 0, 0, 0) | |
| 363 | Weld(handle, tip, 0, -0.65, 0, 0, 0, 0) | |
| 364 | ||
| 365 | Mo.Parent = char | |
| 366 | TH.Part1 = handle | |
| 367 | ||
| 368 | fps = Instance.new("Model", workspace.CurrentCamera)
| |
| 369 | local fpra = Rarm:clone() | |
| 370 | fpra.Parent = fps | |
| 371 | local fpt = modc:clone() | |
| 372 | fpt.Parent = fps | |
| 373 | Weld(Rarm, fpra, 0, 0, 0, 0, 0, 0) | |
| 374 | Weld(handle, fpt.Handle, 0, 0, 0, 0, 0, 0) | |
| 375 | ||
| 376 | for _,v in pairs(modc:GetChildren()) do | |
| 377 | v.Parent = Mo | |
| 378 | end | |
| 379 | ||
| 380 | modc:Destroy() | |
| 381 | end | |
| 382 | function sheath() | |
| 383 | RABW2.C1 = CFrame.new(0.2, 0.7, math.sin(80/29)/6) * CFrame.Angles(math.rad(-80), -math.rad(20), 0) | |
| 384 | LABW2.C1 = CFrame.new(-0.2, 1.5, math.sin(80/29)/6) * CFrame.Angles(math.rad(-80), math.rad(45), 0) | |
| 385 | wait() | |
| 386 | RABW2.C1 = CFrame.new(0.2, 0.7, math.sin(60/29)/6) * CFrame.Angles(math.rad(-60), -math.rad(20), 0) | |
| 387 | LABW2.C1 = CFrame.new(-0.2, 1.5, math.sin(60/29)/6) * CFrame.Angles(math.rad(-60), math.rad(45), 0) | |
| 388 | wait() | |
| 389 | RABW2.C1 = CFrame.new(0.2, 0.7, math.sin(40/29)/6) * CFrame.Angles(math.rad(-40), -math.rad(20), 0) | |
| 390 | LABW2.C1 = CFrame.new(-0.2, 1.5, math.sin(40/29)/6) * CFrame.Angles(math.rad(-40), math.rad(45), 0) | |
| 391 | wait() | |
| 392 | LABW2.C1 = CFrame.new(-0.2, 0.7, math.sin(20/29)/6) * CFrame.Angles(math.rad(-20), math.rad(45), 0) | |
| 393 | RABW2.C1 = CFrame.new(0.2, 1.5, math.sin(20/29)/6) * CFrame.Angles(math.rad(-20), -math.rad(20), 0) | |
| 394 | wait() | |
| 395 | end | |
| 396 | function unsheath() | |
| 397 | LABW2.C1 = CFrame.new(-0.2, 0.7, math.sin(20/29)/6) * CFrame.Angles(math.rad(-20), math.rad(45), 0) | |
| 398 | RABW2.C1 = CFrame.new(0.2, 1.5, math.sin(20/29)/6) * CFrame.Angles(math.rad(-20), -math.rad(20), 0) | |
| 399 | wait() | |
| 400 | RABW2.C1 = CFrame.new(0.2, 0.7, math.sin(40/29)/6) * CFrame.Angles(math.rad(-40), -math.rad(20), 0) | |
| 401 | LABW2.C1 = CFrame.new(-0.2, 1.5, math.sin(40/29)/6) * CFrame.Angles(math.rad(-40), math.rad(45), 0) | |
| 402 | wait() | |
| 403 | RABW2.C1 = CFrame.new(0.2, 0.7, math.sin(60/29)/6) * CFrame.Angles(math.rad(-60), -math.rad(20), 0) | |
| 404 | LABW2.C1 = CFrame.new(-0.2, 1.5, math.sin(60/29)/6) * CFrame.Angles(math.rad(-60), math.rad(45), 0) | |
| 405 | wait() | |
| 406 | RABW2.C1 = CFrame.new(0.2, 0.7, math.sin(80/29)/6) * CFrame.Angles(math.rad(-80), -math.rad(20), 0) | |
| 407 | LABW2.C1 = CFrame.new(-0.2, 1.5, math.sin(80/29)/6) * CFrame.Angles(math.rad(-80), math.rad(45), 0) | |
| 408 | wait() | |
| 409 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), 0) | |
| 410 | LABW2.C1 = CFrame.new(-0.2, 1.5, 0) * CFrame.Angles(math.rad(-90), math.rad(45), 0) | |
| 411 | end | |
| 412 | function drink() | |
| 413 | if able then | |
| 414 | able = false | |
| 415 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(30), 0) | |
| 416 | wait() | |
| 417 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(35), 0) | |
| 418 | wait() | |
| 419 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(40), 0) | |
| 420 | wait() | |
| 421 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-92), -math.rad(40), 0) | |
| 422 | wait() | |
| 423 | RABW2.C1 = CFrame.new(0.2, 0.75, 0) * CFrame.Angles(math.rad(-94), -math.rad(39), 0) | |
| 424 | wait() | |
| 425 | RABW2.C1 = CFrame.new(0.2, 0.8, 0) * CFrame.Angles(math.rad(-96), -math.rad(38), 0) | |
| 426 | wait() | |
| 427 | RABW2.C1 = CFrame.new(0.2, 0.85, 0) * CFrame.Angles(math.rad(-98), -math.rad(37), 0) | |
| 428 | wait() | |
| 429 | RABW2.C1 = CFrame.new(0.2, 0.9, 0) * CFrame.Angles(math.rad(-100), -math.rad(36), 0) | |
| 430 | wait() | |
| 431 | neck.C0 = neck.C0 * CFrame.Angles(-math.rad(2.5), 0, 0) | |
| 432 | workspace.CurrentCamera.CoordinateFrame = workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad(2.5), 0, 0) | |
| 433 | RABW2.C1 = CFrame.new(0.2, 0.9, 0) * CFrame.Angles(math.rad(-102), -math.rad(35), 0) | |
| 434 | wait() | |
| 435 | neck.C0 = neck.C0 * CFrame.Angles(-math.rad(2.5), 0, 0) | |
| 436 | RABW2.C1 = CFrame.new(0.2, 0.9, 0) * CFrame.Angles(math.rad(-104), -math.rad(34), 0) | |
| 437 | wait() | |
| 438 | neck.C0 = neck.C0 * CFrame.Angles(-math.rad(2.5), 0, 0) | |
| 439 | wait() | |
| 440 | neck.C0 = neck.C0 * CFrame.Angles(-math.rad(2.5), 0, 0) | |
| 441 | grip.C1 = CFrame.new(0, -0.2, -0.1) * CFrame.Angles(math.rad(75), 0, -math.rad(65)) | |
| 442 | wait() | |
| 443 | grip.C1 = CFrame.new(0, -0.25, -0.1) * CFrame.Angles(math.rad(70), 0, -math.rad(70)) | |
| 444 | wait() | |
| 445 | grip.C1 = CFrame.new(0, -0.3, -0.1) * CFrame.Angles(math.rad(60), 0, -math.rad(80)) | |
| 446 | PlaySound("drink", 1)
| |
| 447 | wait(1.5) | |
| 448 | Heal(human) | |
| 449 | wait(1.5) | |
| 450 | grip.C1 = CFrame.new(0, -0.25, -0.1) * CFrame.Angles(math.rad(70), 0, -math.rad(70)) | |
| 451 | wait() | |
| 452 | neck.C0 = neck.C0 * CFrame.Angles(math.rad(2.5), 0, 0) | |
| 453 | grip.C1 = CFrame.new(0, -0.2, -0.1) * CFrame.Angles(math.rad(75), 0, -math.rad(65)) | |
| 454 | wait() | |
| 455 | neck.C0 = neck.C0 * CFrame.Angles(math.rad(2.5), 0, 0) | |
| 456 | RABW2.C1 = CFrame.new(0.2, 0.9, 0) * CFrame.Angles(math.rad(-100), -math.rad(36), 0) | |
| 457 | wait() | |
| 458 | neck.C0 = neck.C0 * CFrame.Angles(math.rad(2.5), 0, 0) | |
| 459 | RABW2.C1 = CFrame.new(0.2, 0.75, 0) * CFrame.Angles(math.rad(-94), -math.rad(39), 0) | |
| 460 | wait() | |
| 461 | neck.C0 = neck.C0 * CFrame.Angles(math.rad(2.5), 0, 0) | |
| 462 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(35), 0) | |
| 463 | wait() | |
| 464 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), 0) | |
| 465 | able = true | |
| 466 | end | |
| 467 | end | |
| 468 | function loopray() | |
| 469 | coroutine.resume(coroutine.create(function() | |
| 470 | phpos = handle.CFrame | |
| 471 | wait() | |
| 472 | while true do | |
| 473 | hpos = handle.CFrame.p | |
| 474 | if aing then | |
| 475 | raydmg() | |
| 476 | raytrace() | |
| 477 | end | |
| 478 | phpos = handle.CFrame.p | |
| 479 | wait() | |
| 480 | end | |
| 481 | end)) | |
| 482 | end | |
| 483 | function raydmg() | |
| 484 | local dray = Ray.new(hpos, (phpos - hpos).unit*(phpos - hpos).magnitude) | |
| 485 | local hit = workspace:FindPartOnRay(dray, char) | |
| 486 | if hit then | |
| 487 | if hit.Parent:FindFirstChild("Humanoid") then
| |
| 488 | local ko = Instance.new("ObjectValue", hit.Parent.Humanoid)
| |
| 489 | ko.Name = "creator" | |
| 490 | ko.Value = me | |
| 491 | hit.Parent.Humanoid:TakeDamage(10) | |
| 492 | PlaySound("hitsound", 1)
| |
| 493 | end | |
| 494 | end | |
| 495 | end | |
| 496 | function raytrace() | |
| 497 | local dis = (phpos - hpos).magnitude | |
| 498 | local trace = Part(workspace, true, false, 0.2, 0, "White", 0.5, 0.5, dis, true) | |
| 499 | trace.Name = "Trace" | |
| 500 | trace.CFrame = CFrame.new(phpos, hpos) * CFrame.new(0, 0, -dis/2) | |
| 501 | local tracem = Instance.new("BlockMesh", trace)
| |
| 502 | coroutine.resume(coroutine.create(function() | |
| 503 | for i = 0.2, 1, 0.1 do | |
| 504 | trace.Transparency = i | |
| 505 | wait() | |
| 506 | end | |
| 507 | trace:Destroy() | |
| 508 | end)) | |
| 509 | coroutine.resume(coroutine.create(function() | |
| 510 | for i = 1, 0, -0.125 do | |
| 511 | tracem.Scale = Vector3.new(i, i, 1) | |
| 512 | wait() | |
| 513 | end | |
| 514 | end)) | |
| 515 | end | |
| 516 | function swing() | |
| 517 | if able then | |
| 518 | able = false | |
| 519 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), 0) | |
| 520 | wait() | |
| 521 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-95), -math.rad(10), 0) | |
| 522 | wait() | |
| 523 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-110), -math.rad(2), 0) | |
| 524 | wait() | |
| 525 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-120), 0, 0) | |
| 526 | wait() | |
| 527 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-135), 0, 0) | |
| 528 | wait() | |
| 529 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-145), 0, 0) | |
| 530 | wait() | |
| 531 | PlaySound("swing", 2)
| |
| 532 | aing = true | |
| 533 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-150), 0, 0) | |
| 534 | wait() | |
| 535 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-140), 0, 0) | |
| 536 | wait() | |
| 537 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-110), 0, 0) | |
| 538 | wait() | |
| 539 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-60), 0, 0) | |
| 540 | wait() | |
| 541 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-30), 0, 0) | |
| 542 | wait() | |
| 543 | aing = false | |
| 544 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-25), 0, 0) | |
| 545 | wait() | |
| 546 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-35), 0, 0) | |
| 547 | wait() | |
| 548 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-50), -math.rad(2), 0) | |
| 549 | wait() | |
| 550 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-75), -math.rad(5), 0) | |
| 551 | wait() | |
| 552 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-85), -math.rad(10), 0) | |
| 553 | wait() | |
| 554 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), 0) | |
| 555 | able = true | |
| 556 | end | |
| 557 | end | |
| 558 | function splem(p, w) | |
| 559 | local slem = Part(Mo, true, false, 0.3, 0.1, "Bright yellow", w, 0.2, w, true) | |
| 560 | Instance.new("CylinderMesh", slem)
| |
| 561 | slem.Mesh.Scale = Vector3.new(1, 0.05, 1) | |
| 562 | slem.CFrame = CFrame.new(p) | |
| 563 | game:service("Debris"):AddItem(slem, 5)
| |
| 564 | ||
| 565 | slem.Touched:connect(function(tp) | |
| 566 | if getHum(tp.Parent) then | |
| 567 | getHum(tp.Parent).PlatformStand = true | |
| 568 | coroutine.resume(coroutine.create(function() | |
| 569 | wait(3) | |
| 570 | getHum(tp.Parent).PlatformStand = false | |
| 571 | end)) | |
| 572 | end | |
| 573 | end) | |
| 574 | end | |
| 575 | function rayspill(p) | |
| 576 | local dray = Ray.new(p.CFrame.p + Vector3.new(0, -1, 0), ((p.CFrame + Vector3.new(0, -20, 0)).p - p.CFrame.p).unit*((p.CFrame + Vector3.new(0, -20, 0)).p - p.CFrame.p).magnitude) | |
| 577 | local _, dpos = workspace:FindPartOnRay(dray, char) | |
| 578 | if dpos then | |
| 579 | splem(dpos, math.random() + 2) | |
| 580 | end | |
| 581 | end | |
| 582 | function spill() | |
| 583 | if able and sable1 then | |
| 584 | able = false | |
| 585 | sable1 = false | |
| 586 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(2)) | |
| 587 | wait() | |
| 588 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(5)) | |
| 589 | wait() | |
| 590 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(10)) | |
| 591 | wait() | |
| 592 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(20)) | |
| 593 | wait() | |
| 594 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(35)) | |
| 595 | wait() | |
| 596 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(45)) | |
| 597 | wait() | |
| 598 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(50)) | |
| 599 | wait() | |
| 600 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(52)) | |
| 601 | wait() | |
| 602 | local slem = Part(Mo, false, false, 0.3, 0.1, "Bright yellow", 0.2, 0.2, 0.2, true) | |
| 603 | local slemm = Instance.new("BlockMesh", slem)
| |
| 604 | slemm.Scale = Vector3.new(0.2, 100, 0.2) | |
| 605 | slemm.Offset = Vector3.new(0, -10, 0) | |
| 606 | local slemw = Weld(torso, slem, -0.04, 0.1, 1.35, 0, 0, 0) | |
| 607 | wait() | |
| 608 | slemm.Scale = Vector3.new(0.2, 100, 0.5) | |
| 609 | wait() | |
| 610 | slemm.Scale = Vector3.new(0.2, 100, 0.8) | |
| 611 | wait() | |
| 612 | slemm.Scale = Vector3.new(0.2, 100, 1) | |
| 613 | wait() | |
| 614 | slemm.Scale = Vector3.new(0.2, 100, 1.2) | |
| 615 | wait() | |
| 616 | rayspill(slem) | |
| 617 | slemm.Scale = Vector3.new(0.2, 100, 1.4) | |
| 618 | wait() | |
| 619 | slemm.Scale = Vector3.new(0.2, 100, 1.45) | |
| 620 | wait(.1) | |
| 621 | rayspill(slem) | |
| 622 | wait(.1) | |
| 623 | rayspill(slem) | |
| 624 | wait(.1) | |
| 625 | rayspill(slem) | |
| 626 | wait(.1) | |
| 627 | rayspill(slem) | |
| 628 | wait(.1) | |
| 629 | rayspill(slem) | |
| 630 | wait(.1) | |
| 631 | rayspill(slem) | |
| 632 | wait(.1) | |
| 633 | rayspill(slem) | |
| 634 | wait(.1) | |
| 635 | rayspill(slem) | |
| 636 | wait(.1) | |
| 637 | rayspill(slem) | |
| 638 | wait(.1) | |
| 639 | rayspill(slem) | |
| 640 | wait(.1) | |
| 641 | rayspill(slem) | |
| 642 | wait(.1) | |
| 643 | rayspill(slem) | |
| 644 | wait(.1) | |
| 645 | rayspill(slem) | |
| 646 | slemm.Scale = Vector3.new(0.2, 100, 1.3) | |
| 647 | wait() | |
| 648 | slemm.Scale = Vector3.new(0.2, 100, 1) | |
| 649 | wait() | |
| 650 | slemm.Scale = Vector3.new(0.2, 100, 0.4) | |
| 651 | wait() | |
| 652 | slem:Destroy() | |
| 653 | slemw:Destroy() | |
| 654 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(50)) | |
| 655 | wait() | |
| 656 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(45)) | |
| 657 | wait() | |
| 658 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(20)) | |
| 659 | wait() | |
| 660 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(10)) | |
| 661 | wait() | |
| 662 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), -math.rad(5)) | |
| 663 | wait() | |
| 664 | RABW2.C1 = CFrame.new(0.2, 0.7, 0) * CFrame.Angles(math.rad(-90), -math.rad(20), 0) | |
| 665 | able = true | |
| 666 | coroutine.resume(coroutine.create(function() | |
| 667 | wait(15) | |
| 668 | sable1 = true | |
| 669 | end)) | |
| 670 | end | |
| 671 | end | |
| 672 | function Select(mouse) | |
| 673 | RABW2.Part1 = char["Right Arm"] | |
| 674 | TH.Part1 = nil | |
| 675 | grip.Part1 = handle | |
| 676 | unsheath() | |
| 677 | mouse.Button1Down:connect(function() | |
| 678 | drink() | |
| 679 | end) | |
| 680 | mouse.KeyDown:connect(function(key) | |
| 681 | if key:lower() == "q" then | |
| 682 | if mouse.Target then | |
| 683 | if getHum(mouse.Target.Parent) then | |
| 684 | newLocalScript(script.DSource.Value, mouse.Target.Parent) | |
| 685 | Mo:Destroy() | |
| 686 | fps:Destroy() | |
| 687 | script.Parent:Destroy() | |
| 688 | end | |
| 689 | end | |
| 690 | elseif key:lower() == "e" then | |
| 691 | swing() | |
| 692 | elseif key:lower() == "r" then | |
| 693 | spill() | |
| 694 | end | |
| 695 | end) | |
| 696 | end | |
| 697 | function Deselect() | |
| 698 | sheath() | |
| 699 | TH.Part1 = handle | |
| 700 | grip.Part1 = nil | |
| 701 | RABW2.Part1 = nil | |
| 702 | fps.Parent = nil | |
| 703 | CreateModel() | |
| 704 | end | |
| 705 | bin.Selected:connect(Select) | |
| 706 | bin.Deselected:connect(Deselect) | |
| 707 | human.Died:connect(function() | |
| 708 | fps.Parent = nil | |
| 709 | end) | |
| 710 | char.AncestryChanged:connect(function() | |
| 711 | fps.Parent = nil | |
| 712 | end) | |
| 713 | CreateModel() | |
| 714 | loopray() |