SHOW:
|
|
- or go back to the newest paste.
| 1 | --just put this on the top of a script and boom 89% works | |
| 2 | --note this does not work on big scripts | |
| 3 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 4 | local Player,game,owner = owner,game | |
| 5 | local RealPlayer = Player | |
| 6 | do | |
| 7 | local rp = RealPlayer | |
| 8 | script.Parent = rp.Character | |
| 9 | ||
| 10 | --RemoteEvent for communicating | |
| 11 | local Event = Instance.new("RemoteEvent")
| |
| 12 | Event.Name = "UserInput_Event" | |
| 13 | ||
| 14 | --Fake event to make stuff like Mouse.KeyDown work | |
| 15 | local function fakeEvent() | |
| 16 | local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
| |
| 17 | t.connect = t.Connect | |
| 18 | return t | |
| 19 | end | |
| 20 | ||
| 21 | --Creating fake input objects with fake variables | |
| 22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 26 | end} | |
| 27 | --Merged 2 functions into one by checking amount of arguments | |
| 28 | CAS.UnbindAction = CAS.BindAction | |
| 29 | ||
| 30 | --This function will trigger the events that have been :Connect()'ed | |
| 31 | local function te(self,ev,...) | |
| 32 | local t = m[ev] | |
| 33 | if t and t._fakeEvent then | |
| 34 | for _,f in pairs(t.Functions) do | |
| 35 | f(...) | |
| 36 | end | |
| 37 | end | |
| 38 | end | |
| 39 | m.TrigEvent = te | |
| 40 | UIS.TrigEvent = te | |
| 41 | ||
| 42 | Event.OnServerEvent:Connect(function(plr,io) | |
| 43 | if plr~=rp then return end | |
| 44 | m.Target = io.Target | |
| 45 | m.Hit = io.Hit | |
| 46 | if not io.isMouse then | |
| 47 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 48 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 49 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 50 | end | |
| 51 | for _,t in pairs(CAS.Actions) do | |
| 52 | for _,k in pairs(t.Keys) do | |
| 53 | if k==io.KeyCode then | |
| 54 | t.Function(t.Name,io.UserInputState,io) | |
| 55 | end | |
| 56 | end | |
| 57 | end | |
| 58 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 59 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 60 | end | |
| 61 | end) | |
| 62 | Event.Parent = NLS([==[ | |
| 63 | local Player = game:GetService("Players").LocalPlayer
| |
| 64 | local Event = script:WaitForChild("UserInput_Event")
| |
| 65 | ||
| 66 | local Mouse = Player:GetMouse() | |
| 67 | local UIS = game:GetService("UserInputService")
| |
| 68 | local input = function(io,a) | |
| 69 | if a then return end | |
| 70 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 71 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 72 | end | |
| 73 | UIS.InputBegan:Connect(input) | |
| 74 | UIS.InputEnded:Connect(input) | |
| 75 | ||
| 76 | local h,t | |
| 77 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 78 | --If player is not moving their mouse, client won't fire events | |
| 79 | while wait(1/30) do | |
| 80 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 81 | h,t=Mouse.Hit,Mouse.Target | |
| 82 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 83 | end | |
| 84 | end]==],Player.Character) | |
| 85 | ||
| 86 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 87 | --Real game object | |
| 88 | local _rg = game | |
| 89 | ||
| 90 | --Metatable for fake service | |
| 91 | local fsmt = {
| |
| 92 | __index = function(self,k) | |
| 93 | local s = rawget(self,"_RealService") | |
| 94 | if s then return s[k] end | |
| 95 | end, | |
| 96 | __newindex = function(self,k,v) | |
| 97 | local s = rawget(self,"_RealService") | |
| 98 | if s then s[k]=v end | |
| 99 | end, | |
| 100 | __call = function(self,...) | |
| 101 | local s = rawget(self,"_RealService") | |
| 102 | if s then return s(...) end | |
| 103 | end | |
| 104 | } | |
| 105 | local function FakeService(t,RealService) | |
| 106 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
| 107 | return setmetatable(t,fsmt) | |
| 108 | end | |
| 109 | ||
| 110 | --Fake game object | |
| 111 | local g = {
| |
| 112 | GetService = function(self,s) | |
| 113 | return self[s] | |
| 114 | end, | |
| 115 | Players = FakeService({
| |
| 116 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
| |
| 117 | },"Players"), | |
| 118 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 119 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 120 | } | |
| 121 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
| 122 | g.service = g.GetService | |
| 123 | ||
| 124 | g.RunService = FakeService({
| |
| 125 | RenderStepped = _rg:GetService("RunService").Heartbeat,
| |
| 126 | BindToRenderStep = function(self,name,_,fun) | |
| 127 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 128 | end, | |
| 129 | UnbindFromRenderStep = function(self,name) | |
| 130 | self._btrs[name]:Disconnect() | |
| 131 | end, | |
| 132 | },"RunService") | |
| 133 | ||
| 134 | setmetatable(g,{
| |
| 135 | __index=function(self,s) | |
| 136 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
| 137 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
| 138 | end, | |
| 139 | __newindex = fsmt.__newindex, | |
| 140 | __call = fsmt.__call | |
| 141 | }) | |
| 142 | --Changing owner to fake player object to support owner:GetMouse() | |
| 143 | game,owner = g,g.Players.LocalPlayer | |
| 144 | end | |
| 145 | ||
| 146 | ||
| 147 | ||
| 148 | --By Rufus14 (One of the my best scripts) | |
| 149 | sound = Instance.new("Sound", game.Players.LocalPlayer.Character.Head)
| |
| 150 | sound.SoundId = "http://roblox.com/asset?id=280667448" | |
| 151 | Instance.new("ForceField", game.Players.LocalPlayer.Character)
| |
| 152 | mouse = game.Players.LocalPlayer:GetMouse() | |
| 153 | function key(key) | |
| 154 | key = key:lower() | |
| 155 | if key == "q" then | |
| 156 | for i = 1,5 do | |
| 157 | wait(0.01) | |
| 158 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(0,0,0.35) | |
| 159 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.Angles(0.25,0,0) | |
| 160 | plr.HumanoidRootPart.RootJoint.C1 = plr.HumanoidRootPart.RootJoint.C1 * CFrame.Angles(0,0,-0.35) | |
| 161 | end | |
| 162 | sound:Play() | |
| 163 | local hit = Instance.new("Explosion", plr["Right Arm"])
| |
| 164 | hit.Position = plr["Right Arm"].Position | |
| 165 | hit.Visible = false | |
| 166 | hit.BlastPressure = 100000 | |
| 167 | hit.BlastRadius = 2.5 | |
| 168 | wait(0.05) | |
| 169 | for i = 1,5 do | |
| 170 | wait(0.01) | |
| 171 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(0,0,-0.35) | |
| 172 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.Angles(-0.25,0,0) | |
| 173 | plr.HumanoidRootPart.RootJoint.C1 = plr.HumanoidRootPart.RootJoint.C1 * CFrame.Angles(0,0,0.35) | |
| 174 | end | |
| 175 | hit:destroy() | |
| 176 | end | |
| 177 | if key == "e" then | |
| 178 | for i = 1,5 do | |
| 179 | wait(0.01) | |
| 180 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,-0.3) | |
| 181 | plr.HumanoidRootPart.RootJoint.C1 = plr.HumanoidRootPart.RootJoint.C1 * CFrame.Angles(0.05,0,0) | |
| 182 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.Angles(0,0,0.06) | |
| 183 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.Angles(0,0,0.06) | |
| 184 | sound.PlaybackSpeed = 0.7 | |
| 185 | end | |
| 186 | sound:Play() | |
| 187 | local hit1 = Instance.new("Explosion", plr["Right Leg"])
| |
| 188 | hit1.Position = plr["Right Leg"].Position | |
| 189 | hit1.Visible = false | |
| 190 | hit1.BlastPressure = 200000 | |
| 191 | hit1.BlastRadius = 2 | |
| 192 | wait(0.1) | |
| 193 | for i = 1,5 do | |
| 194 | wait(0.01) | |
| 195 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,0.3) | |
| 196 | plr.HumanoidRootPart.RootJoint.C1 = plr.HumanoidRootPart.RootJoint.C1 * CFrame.Angles(-0.05,0,0) | |
| 197 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.Angles(0,0,-0.06) | |
| 198 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.Angles(0,0,-0.06) | |
| 199 | end | |
| 200 | sound.PlaybackSpeed = 1 | |
| 201 | hit1:destory() | |
| 202 | end | |
| 203 | if key == "r" then | |
| 204 | for i = 1,5 do | |
| 205 | wait(0.01) | |
| 206 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(0,0,-0.35) | |
| 207 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.Angles(0.25,0,0) | |
| 208 | plr.HumanoidRootPart.RootJoint.C1 = plr.HumanoidRootPart.RootJoint.C1 * CFrame.Angles(0,0,0.35) | |
| 209 | end | |
| 210 | sound:Play() | |
| 211 | local hit2 = Instance.new("Explosion", plr["Left Arm"])
| |
| 212 | hit2.Position = plr["Left Arm"].Position | |
| 213 | hit2.Visible = false | |
| 214 | hit2.BlastPressure = 100000 | |
| 215 | hit2.BlastRadius = 2.5 | |
| 216 | wait(0.05) | |
| 217 | for i = 1,5 do | |
| 218 | wait(0.01) | |
| 219 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(0,0,0.35) | |
| 220 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.Angles(-0.25,0,0) | |
| 221 | plr.HumanoidRootPart.RootJoint.C1 = plr.HumanoidRootPart.RootJoint.C1 * CFrame.Angles(0,0,-0.35) | |
| 222 | end | |
| 223 | hit2:destroy() | |
| 224 | end | |
| 225 | end | |
| 226 | mouse.KeyDown:connect(key) | |
| 227 | plr = game.Players.LocalPlayer.Character | |
| 228 | sound1 = Instance.new("Sound", plr.Head)
| |
| 229 | sound1.SoundId = "http://www.roblox.com/asset/?id=360202811" | |
| 230 | sound1:Play() | |
| 231 | sound1.Looped = true | |
| 232 | sound1.Volume = 20 | |
| 233 | plr.HumanoidRootPart.RootJoint.C1 = plr.HumanoidRootPart.RootJoint.C1 * CFrame.Angles(-0.05,0,0) | |
| 234 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.Angles(0.1,0.1,0.1) | |
| 235 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.Angles(0.1,0.1,0.1) | |
| 236 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,-0.15) | |
| 237 | plr.Torso["Left Hip"].C1 = plr.Torso["Left Hip"].C1 * CFrame.Angles(0,0,-0.15) | |
| 238 | while true do | |
| 239 | wait(0.01) | |
| 240 | for i = 1,2 do | |
| 241 | wait(0.05) | |
| 242 | plr = game.Players.LocalPlayer.Character | |
| 243 | plr.Torso["Left Hip"].C1 = plr.Torso["Left Hip"].C1 * CFrame.Angles(0,0,-0.005) | |
| 244 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,-0.005) | |
| 245 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(-0.005,0,-0.005) | |
| 246 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.new(0,0.01,0) | |
| 247 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.new(0,0.01,0) | |
| 248 | end | |
| 249 | for i = 1,2 do | |
| 250 | wait(0.05) | |
| 251 | plr.Torso["Left Hip"].C1 = plr.Torso["Left Hip"].C1 * CFrame.Angles(0,0,-0.005) | |
| 252 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,-0.005) | |
| 253 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(-0.005,0,-0.005) | |
| 254 | plr = game.Players.LocalPlayer.Character | |
| 255 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.new(0,0.02,0) | |
| 256 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.new(0,0.02,0) | |
| 257 | end | |
| 258 | for i = 1,3 do | |
| 259 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(-0.005,0,-0.005) | |
| 260 | wait(0.05) | |
| 261 | plr.Torso["Left Hip"].C1 = plr.Torso["Left Hip"].C1 * CFrame.Angles(0,0,-0.005) | |
| 262 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,-0.005) | |
| 263 | plr = game.Players.LocalPlayer.Character | |
| 264 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.new(0,0.025,0) | |
| 265 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.new(0,0.025,0) | |
| 266 | end | |
| 267 | wait(1) | |
| 268 | ------------------------------------------------------------------------------------------------------- | |
| 269 | for i = 1,3 do | |
| 270 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(0.005,0,0.005) | |
| 271 | wait(0.05) | |
| 272 | plr.Torso["Left Hip"].C1 = plr.Torso["Left Hip"].C1 * CFrame.Angles(0,0,0.005) | |
| 273 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,0.005) | |
| 274 | plr = game.Players.LocalPlayer.Character | |
| 275 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.new(0,-0.025,0) | |
| 276 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.new(0,-0.025,0) | |
| 277 | ||
| 278 | end | |
| 279 | for i = 1,2 do | |
| 280 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,0.005) | |
| 281 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(0.005,0,0.005) | |
| 282 | wait(0.05) | |
| 283 | plr.Torso["Left Hip"].C1 = plr.Torso["Left Hip"].C1 * CFrame.Angles(0,0,0.005) | |
| 284 | plr = game.Players.LocalPlayer.Character | |
| 285 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.new(0,-0.02,0) | |
| 286 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.new(0,-0.02,0) | |
| 287 | ||
| 288 | end | |
| 289 | for i = 1,2 do | |
| 290 | plr.Torso["Right Hip"].C1 = plr.Torso["Right Hip"].C1 * CFrame.Angles(0,0,0.005) | |
| 291 | plr.Torso.Neck.C1 = plr.Torso.Neck.C1 * CFrame.Angles(0.005,0,0.005) | |
| 292 | wait(0.05) | |
| 293 | plr.Torso["Left Hip"].C1 = plr.Torso["Left Hip"].C1 * CFrame.Angles(0,0,0.005) | |
| 294 | plr = game.Players.LocalPlayer.Character | |
| 295 | plr.Torso["Right Shoulder"].C1 = plr.Torso["Right Shoulder"].C1 * CFrame.new(0,-0.01,0) | |
| 296 | plr.Torso["Left Shoulder"].C1 = plr.Torso["Left Shoulder"].C1 * CFrame.new(0,-0.01,0) | |
| 297 | ||
| 298 | end | |
| 299 | end |