SHOW:
|
|
- or go back to the newest paste.
1 | - | local bh = Instance.new("Tool", game.Players.timetodie23232223.Backpack)--no |
1 | + | --https://github.com/Mokiros/roblox-FE-compatibility |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,game,owner = owner,game | |
4 | local RealPlayer = Player | |
5 | do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end local bh = Instance.new("Tool", game.Players.timetodie23232223.Backpack)--no | |
6 | bh.Name = "BanHammer" | |
7 | bh.TextureId = "http://www.roblox.com/asset/?id=10684453" | |
8 | local han = Instance.new("Part", bh) | |
9 | han.Name = "Handle" | |
10 | han.Size = Vector3.new(1,6,1) | |
11 | local hanm = Instance.new("SpecialMesh", han) | |
12 | hanm.MeshType = "FileMesh" | |
13 | hanm.MeshId = "http://www.roblox.com/asset/?id=10604848" | |
14 | hanm.Scale = Vector3.new(0.8,0.8,0.8) | |
15 | hanm.TextureId = "http://www.roblox.com/asset/?id=10605252" | |
16 | local hand = Instance.new("Decal", han) | |
17 | hand.Texture = "http://www.roblox.com/asset/?id=10605252" | |
18 | hand.Face = "Back" | |
19 | local banned = {"The guys who touch the ban hammer","lol"} | |
20 | ||
21 | for i=1, #banned do | |
22 | game.Players.PlayerAdded:connect(function(p) | |
23 | if p.Name == banned[i] then | |
24 | p:Destroy() | |
25 | end | |
26 | end) | |
27 | end | |
28 | ||
29 | han.Touched:connect(function(h) | |
30 | local plr = game.Players:FindFirstChild(h.Parent.Name) | |
31 | if plr == nil then | |
32 | print("Did not find person to ban with ban hammer") | |
33 | else | |
34 | plr:Destroy() | |
35 | table.insert(plr, banned) | |
36 | end | |
37 | end) | |
38 | -------- OMG HAX | |
39 | ||
40 | r = game:service("RunService") | |
41 | ||
42 | ||
43 | local damage = 0 | |
44 | ||
45 | ||
46 | local slash_damage = 0 | |
47 | ||
48 | ||
49 | sword = han | |
50 | Tool = bh | |
51 | ||
52 | ||
53 | local SlashSound = Instance.new("Sound") | |
54 | SlashSound.SoundId = "http://www.roblox.com/asset/?id=" | |
55 | SlashSound.Parent = sword | |
56 | SlashSound.Volume = 1 | |
57 | ||
58 | ||
59 | local UnsheathSound = Instance.new("Sound") | |
60 | UnsheathSound.SoundId = "rbxasset://sounds\\jghj.wav" | |
61 | UnsheathSound.Parent = sword | |
62 | UnsheathSound.Volume = 1 | |
63 | ||
64 | ||
65 | function blow(hit) | |
66 | local humanoid = hit.Parent:findFirstChild("Humanoid") | |
67 | local vCharacter = Tool.Parent | |
68 | local vPlayer = game.Players:playerFromCharacter(vCharacter) | |
69 | local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character | |
70 | if humanoid~=nil and humanoid ~= hum and hum ~= nil then | |
71 | -- final check, make sure sword is in-hand | |
72 | ||
73 | local right_arm = vCharacter:FindFirstChild("Right Arm") | |
74 | if (right_arm ~= nil) then | |
75 | local joint = right_arm:FindFirstChild("RightGrip") | |
76 | if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then | |
77 | tagHumanoid(humanoid, vPlayer) | |
78 | humanoid:TakeDamage(damage) | |
79 | wait(1) | |
80 | untagHumanoid(humanoid) | |
81 | end | |
82 | end | |
83 | ||
84 | ||
85 | end | |
86 | end | |
87 | ||
88 | ||
89 | function tagHumanoid(humanoid, player) | |
90 | local creator_tag = Instance.new("ObjectValue") | |
91 | creator_tag.Value = player | |
92 | creator_tag.Name = "creator" | |
93 | creator_tag.Parent = humanoid | |
94 | end | |
95 | ||
96 | function untagHumanoid(humanoid) | |
97 | if humanoid ~= nil then | |
98 | local tag = humanoid:findFirstChild("creator") | |
99 | if tag ~= nil then | |
100 | tag.Parent = nil | |
101 | end | |
102 | end | |
103 | end | |
104 | ||
105 | ||
106 | function attack() | |
107 | damage = slash_damage | |
108 | SlashSound:play() | |
109 | local anim = Instance.new("StringValue") | |
110 | anim.Name = "toolanim" | |
111 | anim.Value = "Slash" | |
112 | anim.Parent = Tool | |
113 | end | |
114 | ||
115 | ||
116 | function swordUp() | |
117 | Tool.GripForward = Vector3.new(-1,0,0) | |
118 | Tool.GripRight = Vector3.new(0,1,0) | |
119 | Tool.GripUp = Vector3.new(0,0,1) | |
120 | end | |
121 | ||
122 | function swordOut() | |
123 | Tool.GripForward = Vector3.new(0,0,1) | |
124 | Tool.GripRight = Vector3.new(0,-1,0) | |
125 | Tool.GripUp = Vector3.new(-1,0,0) | |
126 | end | |
127 | ||
128 | ||
129 | ||
130 | Tool.Enabled = true | |
131 | ||
132 | function onActivated() | |
133 | ||
134 | if not Tool.Enabled then | |
135 | return | |
136 | end | |
137 | ||
138 | Tool.Enabled = false | |
139 | ||
140 | local character = Tool.Parent; | |
141 | local humanoid = character.Humanoid | |
142 | if humanoid == nil then | |
143 | print("Humanoid not found") | |
144 | return | |
145 | end | |
146 | ||
147 | ||
148 | ||
149 | attack() | |
150 | ||
151 | wait(.4) | |
152 | ||
153 | Tool.Enabled = true | |
154 | end | |
155 | ||
156 | ||
157 | function onEquipped() | |
158 | UnsheathSound:play() | |
159 | end | |
160 | ||
161 | bh.Activated:connect(onActivated) | |
162 | bh.Equipped:connect(onEquipped) | |
163 | ||
164 | ||
165 | connection = sword.Touched:connect(blow) |