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
- print("FE Compatibility code by Mokiros")
- 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(),Button2Up=fakeEvent(),Button2Down=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
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return m:TrigEvent(b and "Button2Down" or "Button2Up")
- 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 typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v 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 rawget(self,s) or _rg:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- 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")
- }
- rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- FakeService(g,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- mas = game.Workspace
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Decal3 = Instance.new("Decal")
- Sound4 = Instance.new("Sound")
- RemoteEvent5 = Instance.new("RemoteEvent")
- Sound6 = Instance.new("Sound")
- RemoteEvent7 = Instance.new("RemoteEvent")
- Sound8 = Instance.new("Sound")
- RemoteEvent9 = Instance.new("RemoteEvent")
- Sound10 = Instance.new("Sound")
- RemoteEvent11 = Instance.new("RemoteEvent")
- Sound12 = Instance.new("Sound")
- RemoteEvent13 = Instance.new("RemoteEvent")
- Sound14 = Instance.new("Sound")
- RemoteEvent15 = Instance.new("RemoteEvent")
- Sound16 = Instance.new("Sound")
- RemoteEvent17 = Instance.new("RemoteEvent")
- Sound18 = Instance.new("Sound")
- RemoteEvent19 = Instance.new("RemoteEvent")
- Sound20 = Instance.new("Sound")
- RemoteEvent21 = Instance.new("RemoteEvent")
- Part22 = Instance.new("Part")
- Decal23 = Instance.new("Decal")
- Motor6D24 = Instance.new("Motor6D")
- Motor6D25 = Instance.new("Motor6D")
- Motor6D26 = Instance.new("Motor6D")
- Motor6D27 = Instance.new("Motor6D")
- Motor6D28 = Instance.new("Motor6D")
- Part29 = Instance.new("Part")
- Part30 = Instance.new("Part")
- Part31 = Instance.new("Part")
- Part32 = Instance.new("Part")
- Humanoid33 = Instance.new("Humanoid")
- Part34 = Instance.new("Part")
- Motor6D35 = Instance.new("Motor6D")
- Model0.Name = "NPC"
- Model0.Parent = mas
- Model0.PrimaryPart = Part1
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(-40.985527, 5.29274511, 17.6500015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Position = Vector3.new(-40.985527, 5.29274511, 17.6500015)
- Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part1.Size = Vector3.new(2, 1, 1)
- Part1.BrickColor = BrickColor.new("Bright yellow")
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Bright yellow")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh2.Parent = Part1
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- Decal3.Name = "face"
- Decal3.Parent = Part1
- Decal3.Texture = "rbxasset://textures/face.png"
- Sound4.Name = "GettingUp"
- Sound4.Parent = Part1
- Sound4.MaxDistance = 150
- Sound4.EmitterSize = 5
- Sound4.MinDistance = 5
- Sound4.SoundId = "rbxasset://sounds/action_get_up.mp3"
- Sound4.Volume = 0.64999997615814
- RemoteEvent5.Name = "CharacterSoundEvent"
- RemoteEvent5.Parent = Sound4
- Sound6.Name = "Died"
- Sound6.Parent = Part1
- Sound6.MaxDistance = 150
- Sound6.EmitterSize = 5
- Sound6.MinDistance = 5
- Sound6.SoundId = "rbxasset://sounds/uuhhh.mp3"
- Sound6.Volume = 0.64999997615814
- RemoteEvent7.Name = "CharacterSoundEvent"
- RemoteEvent7.Parent = Sound6
- Sound8.Name = "FreeFalling"
- Sound8.Parent = Part1
- Sound8.Looped = true
- Sound8.TimePosition = 0.54882329892368
- Sound8.MaxDistance = 150
- Sound8.EmitterSize = 5
- Sound8.MinDistance = 5
- Sound8.SoundId = "rbxasset://sounds/action_falling.mp3"
- Sound8.Volume = 0
- RemoteEvent9.Name = "CharacterSoundEvent"
- RemoteEvent9.Parent = Sound8
- Sound10.Name = "Jumping"
- Sound10.Parent = Part1
- Sound10.MaxDistance = 150
- Sound10.EmitterSize = 5
- Sound10.MinDistance = 5
- Sound10.SoundId = "rbxasset://sounds/action_jump.mp3"
- Sound10.Volume = 0.64999997615814
- RemoteEvent11.Name = "CharacterSoundEvent"
- RemoteEvent11.Parent = Sound10
- Sound12.Name = "Landing"
- Sound12.Parent = Part1
- Sound12.MaxDistance = 150
- Sound12.EmitterSize = 5
- Sound12.MinDistance = 5
- Sound12.SoundId = "rbxasset://sounds/action_jump_land.mp3"
- Sound12.Volume = 1
- RemoteEvent13.Name = "CharacterSoundEvent"
- RemoteEvent13.Parent = Sound12
- Sound14.Name = "Splash"
- Sound14.Parent = Part1
- Sound14.MaxDistance = 150
- Sound14.EmitterSize = 5
- Sound14.MinDistance = 5
- Sound14.SoundId = "rbxasset://sounds/impact_water.mp3"
- Sound14.Volume = 0.64999997615814
- RemoteEvent15.Name = "CharacterSoundEvent"
- RemoteEvent15.Parent = Sound14
- Sound16.Name = "Running"
- Sound16.Parent = Part1
- Sound16.Looped = true
- Sound16.MaxDistance = 150
- Sound16.EmitterSize = 5
- Sound16.MinDistance = 5
- Sound16.Pitch = 1.8500000238419
- Sound16.PlaybackSpeed = 1.8500000238419
- Sound16.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound16.Volume = 0.64999997615814
- RemoteEvent17.Name = "CharacterSoundEvent"
- RemoteEvent17.Parent = Sound16
- Sound18.Name = "Swimming"
- Sound18.Parent = Part1
- Sound18.Looped = true
- Sound18.MaxDistance = 150
- Sound18.EmitterSize = 5
- Sound18.MinDistance = 5
- Sound18.Pitch = 1.6000000238419
- Sound18.PlaybackSpeed = 1.6000000238419
- Sound18.SoundId = "rbxasset://sounds/action_swim.mp3"
- Sound18.Volume = 0.64999997615814
- RemoteEvent19.Name = "CharacterSoundEvent"
- RemoteEvent19.Parent = Sound18
- Sound20.Name = "Climbing"
- Sound20.Parent = Part1
- Sound20.Looped = true
- Sound20.MaxDistance = 150
- Sound20.EmitterSize = 5
- Sound20.MinDistance = 5
- Sound20.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
- Sound20.Volume = 0.64999997615814
- RemoteEvent21.Name = "CharacterSoundEvent"
- RemoteEvent21.Parent = Sound20
- Part22.Name = "Torso"
- Part22.Parent = Model0
- Part22.CFrame = CFrame.new(-40.985527, 3.79274511, 17.6500015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part22.Position = Vector3.new(-40.985527, 3.79274511, 17.6500015)
- Part22.Color = Color3.new(0.2, 0.345098, 0.509804)
- Part22.Size = Vector3.new(2, 2, 1)
- Part22.BrickColor = BrickColor.new("Storm blue")
- Part22.LeftParamA = 0
- Part22.LeftParamB = 0
- Part22.LeftSurface = Enum.SurfaceType.Weld
- Part22.RightParamA = 0
- Part22.RightParamB = 0
- Part22.RightSurface = Enum.SurfaceType.Weld
- Part22.brickColor = BrickColor.new("Storm blue")
- Part22.FormFactor = Enum.FormFactor.Symmetric
- Part22.formFactor = Enum.FormFactor.Symmetric
- Decal23.Name = "roblox"
- Decal23.Parent = Part22
- Motor6D24.Name = "Right Shoulder"
- Motor6D24.Parent = Part22
- Motor6D24.MaxVelocity = 0.10000000149012
- Motor6D24.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D24.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D24.Part0 = Part22
- Motor6D24.Part1 = Part30
- Motor6D24.part1 = Part30
- Motor6D25.Name = "Left Shoulder"
- Motor6D25.Parent = Part22
- Motor6D25.MaxVelocity = 0.10000000149012
- Motor6D25.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D25.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D25.Part0 = Part22
- Motor6D25.Part1 = Part29
- Motor6D25.part1 = Part29
- Motor6D26.Name = "Right Hip"
- Motor6D26.Parent = Part22
- Motor6D26.MaxVelocity = 0.10000000149012
- Motor6D26.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D26.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D26.Part0 = Part22
- Motor6D26.Part1 = Part32
- Motor6D26.part1 = Part32
- Motor6D27.Name = "Left Hip"
- Motor6D27.Parent = Part22
- Motor6D27.MaxVelocity = 0.10000000149012
- Motor6D27.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D27.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D27.Part0 = Part22
- Motor6D27.Part1 = Part31
- Motor6D27.part1 = Part31
- Motor6D28.Name = "Neck"
- Motor6D28.Parent = Part22
- Motor6D28.MaxVelocity = 0.10000000149012
- Motor6D28.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D28.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D28.Part0 = Part22
- Motor6D28.Part1 = Part1
- Motor6D28.part1 = Part1
- Part29.Name = "Left Arm"
- Part29.Parent = Model0
- Part29.CFrame = CFrame.new(-42.485527, 3.79274511, 17.6500015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part29.Position = Vector3.new(-42.485527, 3.79274511, 17.6500015)
- Part29.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part29.Size = Vector3.new(1, 2, 1)
- Part29.BrickColor = BrickColor.new("Bright yellow")
- Part29.CanCollide = false
- Part29.brickColor = BrickColor.new("Bright yellow")
- Part29.FormFactor = Enum.FormFactor.Symmetric
- Part29.formFactor = Enum.FormFactor.Symmetric
- Part30.Name = "Right Arm"
- Part30.Parent = Model0
- Part30.CFrame = CFrame.new(-39.485527, 3.79274511, 17.6500015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part30.Position = Vector3.new(-39.485527, 3.79274511, 17.6500015)
- Part30.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part30.Size = Vector3.new(1, 2, 1)
- Part30.BrickColor = BrickColor.new("Bright yellow")
- Part30.CanCollide = false
- Part30.brickColor = BrickColor.new("Bright yellow")
- Part30.FormFactor = Enum.FormFactor.Symmetric
- Part30.formFactor = Enum.FormFactor.Symmetric
- Part31.Name = "Left Leg"
- Part31.Parent = Model0
- Part31.CFrame = CFrame.new(-41.485527, 1.79274511, 17.6500015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part31.Position = Vector3.new(-41.485527, 1.79274511, 17.6500015)
- Part31.Color = Color3.new(0.121569, 0.501961, 0.113725)
- Part31.Size = Vector3.new(1, 2, 1)
- Part31.BottomSurface = Enum.SurfaceType.Smooth
- Part31.BrickColor = BrickColor.new("Forest green")
- Part31.CanCollide = false
- Part31.brickColor = BrickColor.new("Forest green")
- Part31.FormFactor = Enum.FormFactor.Symmetric
- Part31.formFactor = Enum.FormFactor.Symmetric
- Part32.Name = "Right Leg"
- Part32.Parent = Model0
- Part32.CFrame = CFrame.new(-40.485527, 1.79274511, 17.6500015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part32.Position = Vector3.new(-40.485527, 1.79274511, 17.6500015)
- Part32.Color = Color3.new(0.121569, 0.501961, 0.113725)
- Part32.Size = Vector3.new(1, 2, 1)
- Part32.BottomSurface = Enum.SurfaceType.Smooth
- Part32.BrickColor = BrickColor.new("Forest green")
- Part32.CanCollide = false
- Part32.brickColor = BrickColor.new("Forest green")
- Part32.FormFactor = Enum.FormFactor.Symmetric
- Part32.formFactor = Enum.FormFactor.Symmetric
- Humanoid33.Parent = Model0
- Humanoid33.LeftLeg = Part31
- Humanoid33.RightLeg = Part32
- Humanoid33.Torso = Part34
- Part34.Name = "HumanoidRootPart"
- Part34.Parent = Model0
- Part34.CFrame = CFrame.new(-40.985527, 3.79274511, 17.6500015, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part34.Position = Vector3.new(-40.985527, 3.79274511, 17.6500015)
- Part34.Transparency = 1
- Part34.Size = Vector3.new(2, 2, 1)
- Part34.BottomSurface = Enum.SurfaceType.Smooth
- Part34.CanCollide = false
- Part34.LeftParamA = 0
- Part34.LeftParamB = 0
- Part34.RightParamA = 0
- Part34.RightParamB = 0
- Part34.TopSurface = Enum.SurfaceType.Smooth
- Part34.FormFactor = Enum.FormFactor.Symmetric
- Part34.formFactor = Enum.FormFactor.Symmetric
- Motor6D35.Name = "RootJoint"
- Motor6D35.Parent = Part34
- Motor6D35.MaxVelocity = 0.10000000149012
- Motor6D35.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D35.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D35.Part0 = Part34
- Motor6D35.Part1 = Part22
- Motor6D35.part1 = Part22
- Model0:MoveTo(game.Players.LocalPlayer.Character.Head.Position)
Add Comment
Please, Sign In to add comment