Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- local rp = RealPlayer
- script.Parent = rp.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local Mouse = Player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then return s[k] end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end,
- __call = function(self,...)
- local s = rawget(self,"_RealService")
- if s then return s(...) end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return self[s]
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- }
- rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- g.RunService = FakeService({
- RenderStepped = _rg:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- setmetatable(g,{
- __index=function(self,s)
- return _rg:GetService(s) or typeof(_rg[s])=="function"
- and function(_,...)return _rg[s](_rg,...)end or _rg[s]
- end,
- __newindex = fsmt.__newindex,
- __call = fsmt.__call
- })
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- local player = game.Players.LocalPlayer
- local char = player.Character
- local mouse = player:GetMouse()
- local larm = char["Left Arm"]
- local rarm = char["Right Arm"]
- local lleg = char["Left Leg"]
- local rleg = char["Right Leg"]
- local hed = char.Head
- local torso = char.Torso
- local ASD = BrickColor.new("Pastel brown")
- local hum = char.Humanoid
- local cam = game.Workspace.CurrentCamera
- local root = char.HumanoidRootPart
- local deb = false
- local shot = 0
- local l = game:GetService("Lighting")
- local rs = game:GetService("RunService").RenderStepped
- local stanceToggle = "Normal"
- function tag()
- local cool = Instance.new("BillboardGui")
- cool.Parent = player.Character.Head
- cool.Size = UDim2.new(3, 0,3, 0)
- cool.Name = "cool"
- cool.MaxDistance = 150
- cool.StudsOffset = Vector3.new(0,4,0)
- local text = Instance.new("TextLabel")
- text.Parent = player.Character.Head.cool
- text.Text = "SCRIPT MADE BY MASONSTEINMET (W.I.P lol)"
- text.Font = "Cartoon"
- text.TextStrokeTransparency = 0
- text.TextStrokeColor3 = Color3.new(255, 255, 255)
- text.Size = UDim2.new(1,0,1,0)
- text.BackgroundTransparency = 1
- text.TextScaled = true
- player.Character.Humanoid.BreakJointsOnDeath = false
- player.Character.Humanoid.DisplayDistanceType = "None"
- end
- function headMesh()
- player.Character.Head.Mesh.MeshType = "Brick"
- player.Character.Head.Mesh.Scale = Vector3.new(0.7, 1.25, 1.25)
- player.Character.Head.Mesh.Offset = Vector3.new(0, 0.125, 0)
- player.Character.Head.Material = Enum.Material.SmoothPlastic
- player.Character.Head.face.Texture = "rbxassetid://3528788"
- local face = Instance.new("Decal")
- face.Name = "eye"
- face.Parent = player.Character.Head
- face.Texture = "rbxassetid://257915800"
- while wait() do
- player.Character.Head.face.Texture = "rbxassetid://3528788"
- wait(7)
- player.Character.Head.face.Texture = "rbxassetid://211187842"
- wait(0.5)
- end
- end
- function flatbody()
- local a = Instance.new("BlockMesh")
- a.Parent = larm
- larm.Material = Enum.Material.SmoothPlastic
- local b = Instance.new("BlockMesh")
- b.Parent = rarm
- rarm.Material = Enum.Material.SmoothPlastic
- local c = Instance.new("BlockMesh")
- c.Parent = lleg
- lleg.Material = Enum.Material.SmoothPlastic
- local d = Instance.new("BlockMesh")
- d.Parent = rleg
- rleg.Material = Enum.Material.SmoothPlastic
- local e = Instance.new("BlockMesh")
- e.Parent = player.Character.Torso
- e.Scale = Vector3.new(1,0.97,1)
- player.Character.Torso.Material = Enum.Material.SmoothPlastic
- end
- function hat()
- local m = Instance.new("Part")
- m.Name = "Hat"
- m.Parent = player.Character.Head
- m.Position = player.Character.Head.Position
- m.Orientation = Vector3.new(0,180,0)
- m.BrickColor = BrickColor.new("Electric blue")
- local weld = Instance.new("Weld")
- weld.Parent = player.Character.Torso
- weld.Part0 = player.Character.Head
- weld.Part1 = player.Character.Head.Hat
- weld.C0 = CFrame.new(0, 0.8, -0.2) *CFrame.Angles(0, math.rad(180), 0)
- local mesh = Instance.new("FileMesh")
- mesh.Parent = player.Character.Head.Hat
- mesh.MeshId = "rbxassetid://3669929055"
- mesh.Scale = Vector3.new(1.04,1.04,1.04)
- end
- function value()
- local v = Instance.new("BoolValue")
- v.Parent = player.Character
- v.Name = "Bomb"
- v.Value = true
- end
- function explosion()
- local a = Instance.new("Part")
- a.Parent = workspace
- a.Name = "explode"
- a.Position = player.Character.Torso.Position
- a.Transparency = 1
- a.Anchored = true
- local b = Instance.new("ParticleEmitter")
- b.Parent = workspace.explode
- b.Enabled = true
- b.Texture = "rbxassetid://1946917526"
- b.Color = ColorSequence.new(Color3.fromRGB(255,140,0))
- b.Lifetime = NumberRange.new(3)
- b.Rate = 35
- b.RotSpeed = NumberRange.new(30)
- b.Speed = NumberRange.new(5, 5)
- b.SpreadAngle = Vector2.new(100,100)
- b.Size = NumberSequence.new(7)
- b.LightEmission = 0.55
- b.Transparency = NumberSequence.new(0.7)
- local sound = Instance.new("Sound")
- sound.Parent = workspace.explode
- sound.SoundId = "rbxassetid://2648563122"
- sound.Volume = 0.5
- sound.PlaybackSpeed = 1.5
- sound:Play()
- wait(4)
- a:Destroy()
- end
- function grenadeexplode()
- local t = Instance.new("Part")
- t.Parent = workspace
- t.Name = "explode"
- t.Position = workspace.Grenade.Position
- t.Transparency = 1
- t.Anchored = true
- local y = Instance.new("ParticleEmitter")
- y.Parent = workspace.explode
- y.Enabled = true
- y.Texture = "rbxassetid://1946917526"
- y.Color = ColorSequence.new(Color3.fromRGB(255,140,0))
- y.Lifetime = NumberRange.new(3)
- y.Rate = 35
- y.RotSpeed = NumberRange.new(30)
- y.Speed = NumberRange.new(5, 5)
- y.SpreadAngle = Vector2.new(100,100)
- y.Size = NumberSequence.new(7)
- y.LightEmission = 0.55
- y.Transparency = NumberSequence.new(0.7)
- local sound = Instance.new("Sound")
- sound.Parent = workspace.explode
- sound.SoundId = "rbxassetid://2648563122"
- sound.Volume = 0.5
- sound.PlaybackSpeed = 1.5
- sound:Play()
- delay(8,function()
- t:Destroy()
- end)
- end
- local UIS = game:GetService("UserInputService")
- mouse.KeyDown:Connect(function(key)
- if key == "b" then
- wait(2)
- local a = Instance.new("Part")
- a.Parent = workspace
- a.Position = player.Character.Head.Position + (player.Character.Head.CFrame.lookVector * 4)
- a.Name = "Grenade"
- a.Size = Vector3.new(1.27, 1, 1.38)
- a.Transparency = 0
- local b = Instance.new("BodyForce")
- b.Parent = a
- b.Force = player.Character.Head.CFrame.lookVector * 80 + Vector3.new(0,225,0)
- a.CanCollide = true
- wait(.4)
- b:Destroy()
- wait(0.8)
- a.Transparency = 1
- a.Anchored = true
- local t = Instance.new("Part")
- t.Parent = workspace
- t.Name = "explode"
- t.Position = a.Position
- t.Transparency = 1
- t.Anchored = true
- local y = Instance.new("ParticleEmitter")
- y.Parent = workspace.explode
- y.Enabled = true
- y.Texture = "rbxassetid://1946917526"
- y.Color = ColorSequence.new(Color3.fromRGB(255,140,0))
- y.Lifetime = NumberRange.new(3)
- y.Rate = 35
- y.RotSpeed = NumberRange.new(30)
- y.Speed = NumberRange.new(8, 8)
- y.SpreadAngle = Vector2.new(100,100)
- y.Size = NumberSequence.new(7)
- y.LightEmission = 0.55
- y.Transparency = NumberSequence.new(0.7)
- local sound = Instance.new("Sound")
- sound.Parent = player.Character.Torso
- sound.SoundId = "rbxassetid://2648563122"
- sound.Volume = 0.5
- sound.PlaybackSpeed = 1.5
- sound:Play()
- delay(1,function()
- t:Destroy()
- a:Destroy()
- end)
- end
- end)
- value()
- hat()
- tag()
- flatbody()
- headMesh()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement