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
- print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- 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 TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(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
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled 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 every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true 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
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __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 RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame: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(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- Player = owner
- Character = Player.Character
- RightArm = Character.RightUpperArm
- Torso = Character.UpperTorso
- RightHand = Character["RightHand"]
- Humanoid = Character.Humanoid
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Part2 = Instance.new("Part")
- Part3 = Instance.new("Part")
- Part4 = Instance.new("Part")
- SpecialMesh5 = Instance.new("SpecialMesh")
- Part6 = Instance.new("Part")
- Part7 = Instance.new("Part")
- Part8 = Instance.new("Part")
- Weld9 = Instance.new("Weld")
- Weld10 = Instance.new("Weld")
- Weld11 = Instance.new("Weld")
- Weld12 = Instance.new("Weld")
- Weld13 = Instance.new("Weld")
- Weld14 = Instance.new("Weld")
- Weld15 = Instance.new("Weld")
- Weld16 = Instance.new("Weld")
- Weld17 = Instance.new("Weld")
- Part18 = Instance.new("Part")
- Part19 = Instance.new("Part")
- SpecialMesh20 = Instance.new("SpecialMesh")
- Part21 = Instance.new("Part")
- Model0.Name = "Sword"
- Model0.Parent = mas
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(-5.5, 0.75, 7.12499714, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
- Part1.Orientation = Vector3.new(0, 90, -90)
- Part1.Position = Vector3.new(-5.5, 0.75, 7.12499714)
- Part1.Rotation = Vector3.new(0, 89.9599991, 0)
- Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part1.Size = Vector3.new(0.5, 1.75, 0.5)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Bright yellow")
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Bright yellow")
- Part2.Parent = Model0
- Part2.CFrame = CFrame.new(-5.5, 0.75, 8.37499809, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
- Part2.Orientation = Vector3.new(0, 90, -90)
- Part2.Position = Vector3.new(-5.5, 0.75, 8.37499809)
- Part2.Rotation = Vector3.new(0, 89.9599991, 0)
- Part2.Color = Color3.new(0.643137, 0.741176, 0.278431)
- Part2.Size = Vector3.new(0.5, 0.25, 0.5)
- Part2.BottomSurface = Enum.SurfaceType.Smooth
- Part2.BrickColor = BrickColor.new("Br. yellowish green")
- Part2.TopSurface = Enum.SurfaceType.Smooth
- Part2.brickColor = BrickColor.new("Br. yellowish green")
- Part3.Parent = Model0
- Part3.CFrame = CFrame.new(-5.5, 0.12500006, 7.99999619, 0, 0, 0.999999881, -1, 0, 0, 0, -1, 0)
- Part3.Orientation = Vector3.new(0, 90, -90)
- Part3.Position = Vector3.new(-5.5, 0.12500006, 7.99999619)
- Part3.Rotation = Vector3.new(0, 89.9700012, 0)
- Part3.Color = Color3.new(0.129412, 0.329412, 0.72549)
- Part3.Size = Vector3.new(0.25, 0.5, 0.5)
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.BrickColor = BrickColor.new("Deep blue")
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.brickColor = BrickColor.new("Deep blue")
- Part4.Parent = Model0
- Part4.CFrame = CFrame.new(-5.5, 0.625, 5.99999809, 0.999999762, 0, 0, 0, 0, 1, 0, -1, 0)
- Part4.Orientation = Vector3.new(-90, 0, 0)
- Part4.Position = Vector3.new(-5.5, 0.625, 5.99999809)
- Part4.Rotation = Vector3.new(-90, 0, 0)
- Part4.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part4.Size = Vector3.new(0.5, 0.5, 0.25)
- Part4.BottomSurface = Enum.SurfaceType.Smooth
- Part4.BrickColor = BrickColor.new("Bright yellow")
- Part4.TopSurface = Enum.SurfaceType.Smooth
- Part4.brickColor = BrickColor.new("Bright yellow")
- SpecialMesh5.Parent = Part4
- SpecialMesh5.MeshType = Enum.MeshType.Wedge
- Part6.Parent = Model0
- Part6.CFrame = CFrame.new(-5.5, 0.749998033, 8.99999428, 0, 0, 0.999999881, -1, 0, 0, 0, -1, 0)
- Part6.Orientation = Vector3.new(0, 90, -90)
- Part6.Position = Vector3.new(-5.5, 0.749998033, 8.99999428)
- Part6.Rotation = Vector3.new(0, 89.9700012, 0)
- Part6.Color = Color3.new(0.643137, 0.741176, 0.278431)
- Part6.Size = Vector3.new(0.25, 1.5, 0.25)
- Part6.BottomSurface = Enum.SurfaceType.Smooth
- Part6.BrickColor = BrickColor.new("Br. yellowish green")
- Part6.TopSurface = Enum.SurfaceType.Smooth
- Part6.brickColor = BrickColor.new("Br. yellowish green")
- Part7.Parent = Model0
- Part7.CFrame = CFrame.new(-5.5, 1.37499809, 7.99999619, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
- Part7.Orientation = Vector3.new(0, 90, -90)
- Part7.Position = Vector3.new(-5.5, 1.37499809, 7.99999619)
- Part7.Rotation = Vector3.new(0, 89.9599991, 0)
- Part7.Color = Color3.new(0.129412, 0.329412, 0.72549)
- Part7.Size = Vector3.new(0.25, 0.5, 0.5)
- Part7.BottomSurface = Enum.SurfaceType.Smooth
- Part7.BrickColor = BrickColor.new("Deep blue")
- Part7.TopSurface = Enum.SurfaceType.Smooth
- Part7.brickColor = BrickColor.new("Deep blue")
- Part8.Parent = Model0
- Part8.CFrame = CFrame.new(-5.5, 0.749997079, 8.12499619, 0, 0, 0.999999881, -1, 0, 0, 0, -1, 0)
- Part8.Orientation = Vector3.new(0, 90, -90)
- Part8.Position = Vector3.new(-5.5, 0.749997079, 8.12499619)
- Part8.Rotation = Vector3.new(0, 89.9700012, 0)
- Part8.Color = Color3.new(0.129412, 0.329412, 0.72549)
- Part8.Size = Vector3.new(1, 0.25, 0.5)
- Part8.BottomSurface = Enum.SurfaceType.Smooth
- Part8.BrickColor = BrickColor.new("Deep blue")
- Part8.TopSurface = Enum.SurfaceType.Smooth
- Part8.brickColor = BrickColor.new("Deep blue")
- Weld9.Name = "BTWeld"
- Weld9.Parent = Part8
- Weld9.C1 = CFrame.new(9.53674316e-07, 0.874998093, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld9.Part0 = Part8
- Weld9.Part1 = Part6
- Weld9.part1 = Part6
- Weld10.Name = "BTWeld"
- Weld10.Parent = Part8
- Weld10.C1 = CFrame.new(-0.62499702, -0.125, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld10.Part0 = Part8
- Weld10.Part1 = Part3
- Weld10.part1 = Part3
- Weld11.Name = "BTWeld"
- Weld11.Parent = Part8
- Weld11.C1 = CFrame.new(0, -0.25000298, -0.875003815, 0, 0, 0.99999994, -1, -5.56362707e-08, 0, 5.56362707e-08, -1, 0)
- Weld11.Part0 = Part8
- Weld11.Part1 = Part21
- Weld11.part1 = Part21
- Weld12.Name = "BTWeld"
- Weld12.Parent = Part8
- Weld12.C1 = CFrame.new(2.92062759e-06, 0.250001907, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
- Weld12.Part0 = Part8
- Weld12.Part1 = Part2
- Weld12.part1 = Part2
- Weld13.Name = "BTWeld"
- Weld13.Parent = Part8
- Weld13.C1 = CFrame.new(0.625001013, -0.125, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
- Weld13.Part0 = Part8
- Weld13.Part1 = Part7
- Weld13.part1 = Part7
- Weld14.Name = "BTWeld"
- Weld14.Parent = Part8
- Weld14.C1 = CFrame.new(2.92062759e-06, 1.50000191, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
- Weld14.Part0 = Part8
- Weld14.Part1 = Part18
- Weld14.part1 = Part18
- Weld15.Name = "BTWeld"
- Weld15.Parent = Part8
- Weld15.C1 = CFrame.new(2.92062759e-06, -0.999999046, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0.999999881)
- Weld15.Part0 = Part8
- Weld15.Part1 = Part1
- Weld15.part1 = Part1
- Weld16.Name = "BTWeld"
- Weld16.Parent = Part8
- Weld16.C1 = CFrame.new(0, -2.12499714, 0.125002921, 0, 0, -0.999999881, 0, 1, 0, 1, 0, 0)
- Weld16.Part0 = Part8
- Weld16.Part1 = Part19
- Weld16.part1 = Part19
- Weld17.Name = "BTWeld"
- Weld17.Parent = Part8
- Weld17.C1 = CFrame.new(0, -2.12499809, 0.124997079, 0, 0, 0.999999881, 0, 1, 0, -1, 0, 0)
- Weld17.Part0 = Part8
- Weld17.Part1 = Part4
- Weld17.part1 = Part4
- Part18.Name = "SwordHandle"
- Part18.Parent = Model0
- Part18.CFrame = CFrame.new(-5.5, 0.75, 9.62499809, 0, 0, 0.999999762, -1, 0, 0, 0, -1, 0)
- Part18.Orientation = Vector3.new(0, 90, -90)
- Part18.Position = Vector3.new(-5.5, 0.75, 9.62499809)
- Part18.Rotation = Vector3.new(0, 89.9599991, 0)
- Part18.Color = Color3.new(0.643137, 0.741176, 0.278431)
- Part18.Size = Vector3.new(0.5, 0.25, 0.5)
- Part18.BottomSurface = Enum.SurfaceType.Smooth
- Part18.BrickColor = BrickColor.new("Br. yellowish green")
- Part18.TopSurface = Enum.SurfaceType.Smooth
- Part18.brickColor = BrickColor.new("Br. yellowish green")
- Part19.Parent = Model0
- Part19.CFrame = CFrame.new(-5.5, 0.875, 5.99999905, -0.999999762, 0, 0, 0, 0, -1, 0, -1, 0)
- Part19.Orientation = Vector3.new(90, 180, 0)
- Part19.Position = Vector3.new(-5.5, 0.875, 5.99999905)
- Part19.Rotation = Vector3.new(90, 0, -180)
- Part19.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part19.Size = Vector3.new(0.5, 0.5, 0.25)
- Part19.BottomSurface = Enum.SurfaceType.Smooth
- Part19.BrickColor = BrickColor.new("Bright yellow")
- Part19.TopSurface = Enum.SurfaceType.Smooth
- Part19.brickColor = BrickColor.new("Bright yellow")
- SpecialMesh20.Parent = Part19
- SpecialMesh20.MeshType = Enum.MeshType.Wedge
- Part21.Name = "Hand"
- Part21.Parent = Model0
- Part21.CFrame = CFrame.new(-5.5, 1, 9, 0.99999994, 0, 0, 0, 1, -5.56362707e-08, 0, 5.56362707e-08, 1)
- Part21.Position = Vector3.new(-5.5, 1, 9)
- Part21.Size = Vector3.new(1, 0.300000012, 1)
- Part21.BottomSurface = Enum.SurfaceType.Smooth
- Part21.TopSurface = Enum.SurfaceType.Smooth
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = Character
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- Model0.Hand.Transparency = 1
- function CreateWeld(parent,name,a,b,cf)
- local Weld = Instance.new("Weld",parent)
- Weld.Name = name
- Weld.Part0 = a
- Weld.Part1 = b
- Weld.C0 = cf
- end
- CreateWeld(Character,"SwordWeld",Model0.Hand,RightHand,CFrame.new(0, 0, 0))
- DMG = 0
- mouse = Player:GetMouse()
- Animation = Instance.new("Animation",Character)
- Animation.Name = "SlashAnimation"
- Animation.AnimationId = "rbxassetid://2524287767"
- SlashAnim = Humanoid:LoadAnimation(Animation)
- mouse.Button1Down:connect(function()
- DMG = 15
- SlashAnim:Play()
- wait(.7)
- DMG = 0
- end)
- Part1.Touched:connect(function(hit)
- local Human = hit.Parent:FindFirstChildOfClass("Humanoid")
- if Human then
- Human.Health = Human.Health - DMG
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement