Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by WaverlyCole");InternalData = {}
- do
- script.Parent = owner.Character
- local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
- local function NewFakeEvent()
- local Bind = Instance.new("BindableEvent")
- local Fake;Fake = {Connections = {},
- fakeEvent=true;
- Connect=function(self,Func)
- Bind.Event:connect(Func)
- self.Connections[Bind] = true
- return setmetatable({Connected = true},{
- __index = function (self,Index)
- if Index:lower() == "disconnect" then
- return function() Fake.Connections[Bind] = false;self.Connected = false end
- end
- return Fake[Index]
- end;
- __tostring = function() return "Connection" end;
- })
- end}
- Fake.connect = Fake.Connect;return Fake;
- end
- local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
- local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
- local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
- self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
- end};ContextActionService.UnBindAction = ContextActionService.BindAction
- local function TriggerEvent(self,Event,...)
- local Trigger = Mouse[Event]
- if Trigger and Trigger.fakeEvent and Trigger.Connections then
- for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
- end
- end
- Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
- Event.OnServerEvent:Connect(function(FiredBy,Input)
- if FiredBy.Name ~= owner.Name then return end
- if Input.MouseEvent then
- Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
- else
- local Begin = Input.UserInputState == Enum.UserInputState.Begin
- if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
- for _,Action in pairs(ContextActionService.Actions) do
- for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
- end
- Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
- UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
- end
- end)
- InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
- Event.Parent = NLS([[
- local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
- local Input = function(Input,gameProcessedEvent)
- if gameProcessedEvent then return end
- Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
- end
- UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
- local Hit,Target
- while wait(1/30) do
- if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
- Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
- end
- end
- ]],owner.Character)
- end
- RealGame = game;game = setmetatable({},{
- __index = function (self,Index)
- local Sandbox = function (Thing)
- if Thing:IsA("Player") then
- local RealPlayer = Thing
- return setmetatable({},{
- __index = function (self,Index)
- local Type = type(RealPlayer[Index])
- if Type == "function" then
- if Index:lower() == "getmouse" or Index:lower() == "mouse" then
- return function (self)return InternalData["Mouse"] end
- end
- return function (self,...)return RealPlayer[Index](RealPlayer,...) end
- end
- return RealPlayer[Index]
- end;
- __tostring = function(self) return RealPlayer.Name end
- })
- end
- end
- if RealGame[Index] then
- local Type = type(RealGame[Index])
- if Type == "function" then
- if Index:lower() == "getservice" or Index:lower() == "service" then
- return function (self,Service)
- local FakeServices = {
- ["players"] = function()
- return setmetatable({},{
- __index = function (self2,Index2)
- local RealService = RealGame:GetService(Service)
- local Type2 = type(Index2)
- if Type2 == "function" then
- return function (self,...) return RealService[Index2](RealService,...)end
- else
- if Index2:lower() == "localplayer" then return Sandbox(owner) end
- return RealService[Index2]
- end
- end;
- __tostring = function(self) return RealGame:GetService(Service).Name end
- })
- end;
- ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
- ["userinputservice"] = function() return InternalData["UserInputService"] end;
- ["runservice"] = function()
- return setmetatable({},{
- __index = function(self2,Index2)
- local RealService = RealGame:GetService(Service)
- local Type2 = type(Index2)
- if Type2 == "function" then
- return function (self,...) return RealService[Index2](RealService,...) end
- else
- local RunServices = {
- ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
- ["renderstepped"] = function() return RealService["Stepped"] end
- }
- if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
- return RealService[Index2]
- end
- end
- })
- end
- }
- if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
- return RealGame:GetService(Service)
- end
- end
- return function (self,...) return RealGame[Index](RealGame,...) end
- else
- if game:GetService(Index) then return game:GetService(Index) end
- return RealGame[Index]
- end
- end
- return nil
- end
- });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
- print(" made by zachrogamehard133447")
- local runDummyScript = function(f,scri)
- local oldenv = getfenv(f)
- local newenv = setmetatable({}, {
- __index = function(_, k)
- if k:lower() == 'script' then
- return scri
- else
- return oldenv[k]
- end
- end
- })
- setfenv(f, newenv)
- ypcall(function() f() end)
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- mas.Name = "CompiledModel"
- o1 = Instance.new("Tool")
- o2 = Instance.new("Part")
- o3 = Instance.new("Sound")
- o4 = Instance.new("Sound")
- o5 = Instance.new("Sound")
- o6 = Instance.new("SpecialMesh")
- o8 = Instance.new("Script")
- o9 = Instance.new("LocalScript")
- o10 = Instance.new("StringValue")
- o11 = Instance.new("StringValue")
- o12 = Instance.new("StringValue")
- o13 = Instance.new("StringValue")
- o1.Name = "Sword"
- o1.Parent = mas
- o1.TextureId = "http://www.roblox.com/asset/?id=124987047"
- o1.GripForward = Vector3.new(-1, -0, -0)
- o1.GripPos = Vector3.new(0, 0, -1.5)
- o1.GripRight = Vector3.new(0, 1, 0)
- o1.GripUp = Vector3.new(0, 0, 1)
- o2.Name = "Handle"
- o2.Parent = o1
- o2.BrickColor = BrickColor.new("Dark stone grey")
- o2.Reflectance = 0.40000000596046
- o2.Position = Vector3.new(-467.235016, 13.2509699, -419.589142)
- o2.Rotation = Vector3.new(-180, 5.09000015, -90)
- o2.CanCollide = false
- o2.Locked = true
- o2.FormFactor = Enum.FormFactor.Custom
- o2.Size = Vector3.new(1, 0.800000012, 4)
- o2.CFrame = CFrame.new(-467.235016, 13.2509699, -419.589142, -8.74267062e-06, 0.996058226, 0.0887008458, 1, 7.95604228e-06, 9.22190611e-06, 8.47984938e-06, 0.0887008458, -0.996058226)
- o2.BottomSurface = Enum.SurfaceType.Smooth
- o2.TopSurface = Enum.SurfaceType.Smooth
- o2.Color = Color3.new(0.388235, 0.372549, 0.384314)
- o2.Position = Vector3.new(-467.235016, 13.2509699, -419.589142)
- o3.Name = "Lunge"
- o3.Parent = o2
- o3.SoundId = "http://www.roblox.com/asset/?id=12222208"
- o3.Volume = 0.60000002384186
- o4.Name = "Slash"
- o4.Parent = o2
- o4.SoundId = "http://www.roblox.com/asset/?id=12222216"
- o4.Volume = 0.69999998807907
- o5.Name = "Unsheath"
- o5.Parent = o2
- o5.SoundId = "http://www.roblox.com/asset/?id=12222225"
- o5.Volume = 1
- o6.Parent = o2
- o6.MeshId = "http://www.roblox.com/asset/?id=12221720"
- o6.TextureId = "http://www.roblox.com/asset/?id=12224218"
- o6.MeshType = Enum.MeshType.FileMesh
- o8.Name = "SwordScript"
- o8.Parent = o1
- table.insert(cors,coroutine.create(function()
- wait()
- runDummyScript(function()
- --Rescripted by Luckymaxer
- Tool = script.Parent
- Handle = Tool:WaitForChild("Handle")
- Mesh = Handle:WaitForChild("Mesh")
- Players = game:GetService("Players")
- Debris = game:GetService("Debris")
- RunService = game:GetService("RunService")
- BaseUrl = "http://www.roblox.com/asset/?id="
- Grips = {
- Up = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0),
- Out = CFrame.new(0, 0, -1.5, 0, -1, -0, -1, 0, -0, 0, 0, -1),
- }
- DamageValues = {
- BaseDamage = 5,
- SlashDamage = 10,
- LungeDamage = 30,
- }
- Damage = DamageValues.BaseDamage
- Sounds = {
- Slash = Handle:WaitForChild("Slash"),
- Lunge = Handle:WaitForChild("Lunge"),
- Unsheath = Handle:WaitForChild("Unsheath"),
- }
- LastAttack = 0
- ToolEquipped = false
- Tool.Enabled = true
- function SwordUp()
- Tool.Grip = Grips.Up
- end
- function SwordOut()
- Tool.Grip = Grips.Out
- end
- function IsTeamMate(Player1, Player2)
- return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
- end
- function TagHumanoid(humanoid, player)
- local Creator_Tag = Instance.new("ObjectValue")
- Creator_Tag.Name = "creator"
- Creator_Tag.Value = player
- Debris:AddItem(Creator_Tag, 2)
- Creator_Tag.Parent = humanoid
- end
- function UntagHumanoid(humanoid)
- for i, v in pairs(humanoid:GetChildren()) do
- if v:IsA("ObjectValue") and v.Name == "creator" then
- v:Destroy()
- end
- end
- end
- function Attack()
- Damage = DamageValues.SlashDamage
- Sounds.Slash:Play()
- local Anim = Instance.new("StringValue")
- Anim.Name = "toolanim"
- Anim.Value = "Slash"
- Anim.Parent = Tool
- end
- function Lunge()
- Damage = DamageValues.LungeDamage
- Sounds.Lunge:Play()
- local Anim = Instance.new("StringValue")
- Anim.Name = "toolanim"
- Anim.Value = "Lunge"
- Anim.Parent = Tool
- local Force = Instance.new("BodyVelocity")
- Force.velocity = Vector3.new(0, 10, 0)
- Force.maxForce = Vector3.new(0, 4000, 0)
- Debris:AddItem(Force, 0.5)
- Force.Parent = RootPart
- wait(0.25)
- SwordOut()
- wait(0.25)
- if Force and Force.Parent then
- Force:Destroy()
- end
- wait(0.5)
- SwordUp()
- end
- function Blow(Hit)
- if not Hit or not Hit.Parent or not CheckIfAlive() then
- return
- end
- local RightArm = (Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand"))
- if not RightArm then
- return
- end
- local RightGrip = RightArm:FindFirstChild("RightGrip")
- if not RightGrip or (RightGrip.Part0 ~= RightArm and RightGrip.Part1 ~= RightArm) or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
- return
- end
- local character = Hit.Parent
- local humanoid = character:FindFirstChild("Humanoid")
- if not humanoid then
- return
- end
- local player = Players:GetPlayerFromCharacter(character)
- if player and (player == Player or IsTeamMate(Player, player)) then
- return
- end
- UntagHumanoid(humanoid)
- TagHumanoid(humanoid, Player)
- humanoid:TakeDamage(Damage)
- end
- function Activated()
- if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
- return
- end
- Tool.Enabled = false
- local Tick = RunService.Stepped:wait()
- if (Tick - LastAttack) < 0.2 then
- Lunge()
- else
- Attack()
- end
- Damage = DamageValues.BaseDamage
- LastAttack = Tick
- Tool.Enabled = true
- end
- function CheckIfAlive()
- return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and RootPart and RootPart.Parent and Player and Player.Parent) and true) or false)
- end
- function Equipped()
- Character = Tool.Parent
- Player = Players:GetPlayerFromCharacter(Character)
- Humanoid = Character:FindFirstChild("Humanoid")
- RootPart = Character:FindFirstChild("HumanoidRootPart")
- if not CheckIfAlive() then
- return
- end
- ToolEquipped = true
- Sounds.Unsheath:Play()
- end
- function Unequipped()
- ToolEquipped = false
- end
- SwordUp()
- Handle.Touched:connect(Blow)
- Tool.Activated:connect(Activated)
- Tool.Equipped:connect(Equipped)
- Tool.Unequipped:connect(Unequipped)
- end,o8)
- end))
- o9.Name = "MouseIcon"
- o9.Parent = o1
- table.insert(cors,coroutine.create(function()
- wait()
- runDummyScript(function()
- --Rescripted by Luckymaxer
- Mouse_Icon = "rbxasset://textures/GunCursor.png"
- Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
- Tool = script.Parent
- Mouse = nil
- function UpdateIcon()
- if Mouse then
- Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
- end
- end
- function OnEquipped(ToolMouse)
- Mouse = ToolMouse
- UpdateIcon()
- end
- function OnChanged(Property)
- if Property == "Enabled" then
- UpdateIcon()
- end
- end
- Tool.Equipped:connect(OnEquipped)
- Tool.Changed:connect(OnChanged)
- end,o9)
- end))
- o10.Name = "toolanim"
- o10.Parent = o1
- o10.Value = "Slash"
- o11.Name = "toolanim"
- o11.Parent = o1
- o11.Value = "Slash"
- o12.Name = "toolanim"
- o12.Parent = o1
- o12.Value = "Slash"
- o13.Name = "toolanim"
- o13.Parent = o1
- o13.Value = "Slash"
- mas.Parent = workspace
- mas:MakeJoints()
- local mas1 = mas:GetChildren()
- for i=1,#mas1 do
- mas1[i].Parent = script
- ypcall(function() mas1[i]:MakeJoints() end)
- end
- mas:Destroy()
- for i=1,#cors do
- coroutine.resume(cors[i])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement