SHOW:
|
|
- or go back to the newest paste.
| 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
| |
| 6 | ||
| 7 | receiver = game.Players.Vfen | |
| 8 | path = receiver.Backpack | |
| 9 | ||
| 10 | t = Instance.new("Tool")
| |
| 11 | t.GripForward = Vector3.new(-0, 0.000006, -1) | |
| 12 | t.GripPos = Vector3.new(0, -0.3, -0.5) | |
| 13 | t.GripRight = Vector3.new(1, 0, -0) | |
| 14 | t.GripUp = Vector3.new(0, 1, 0.000006) | |
| 15 | t.Name = "VI Portal gun" | |
| 16 | t.Enabled = true | |
| 17 | t.Parent = path | |
| 18 | ||
| 19 | h = Instance.new("Part")
| |
| 20 | h.BrickColor = BrickColor.White() | |
| 21 | h.Size = Vector3.new(1,1,2) | |
| 22 | h.Name = "Handle" | |
| 23 | h.Parent = t | |
| 24 | ||
| 25 | s = Instance.new("Sound")
| |
| 26 | s.SoundId = "rbxasset://sounds/bass.wav" | |
| 27 | s.Volume = 0.5 | |
| 28 | s.Name = "failure" | |
| 29 | s.Parent = h | |
| 30 | ||
| 31 | s = Instance.new("Sound")
| |
| 32 | s.SoundId = "rbxasset://sounds/electronicpingshort.wav" | |
| 33 | s.Volume = 0.5 | |
| 34 | s.Name = "fire" | |
| 35 | s.Parent = h | |
| 36 | ||
| 37 | s = Instance.new("Script")
| |
| 38 | s.Source = [[function tele(hit) | |
| 39 | if (script.Parent.Parent:findFirstChild("PortalB") ~= nil and hit.Parent:findFirstChild("Torso") ~= nil) then
| |
| 40 | if (hit.Parent.Torso:findFirstChild("t") ~= nil) then return end
| |
| 41 | hit.Parent.Torso.CFrame = CFrame.new(script.Parent.Parent.PortalB.Position) | |
| 42 | h = Instance.new("Humanoid")
| |
| 43 | h.Name = "t" | |
| 44 | h.Parent = hit.Parent.Torso | |
| 45 | wait(0.5) | |
| 46 | h:remove() | |
| 47 | end | |
| 48 | end | |
| 49 | ||
| 50 | script.Parent.Touched:connect(tele) | |
| 51 | ||
| 52 | ]] | |
| 53 | ||
| 54 | s.Disabled = true | |
| 55 | s.Name = "PortalScriptA" | |
| 56 | s.Parent = t | |
| 57 | ||
| 58 | s = Instance.new("Script")
| |
| 59 | s.Source = [[function tele(hit) | |
| 60 | if (script.Parent.Parent:findFirstChild("PortalA") ~= nil and hit.Parent:findFirstChild("Torso") ~= nil) then
| |
| 61 | if (hit.Parent.Torso:findFirstChild("t") ~= nil) then return end
| |
| 62 | hit.Parent.Torso.CFrame = CFrame.new(script.Parent.Parent.PortalA.Position) | |
| 63 | h = Instance.new("Humanoid")
| |
| 64 | h.Name = "t" | |
| 65 | h.Parent = hit.Parent.Torso | |
| 66 | wait(0.5) | |
| 67 | h:remove() | |
| 68 | end | |
| 69 | end | |
| 70 | ||
| 71 | script.Parent.Touched:connect(tele) | |
| 72 | ||
| 73 | ]] | |
| 74 | ||
| 75 | s.Disabled = true | |
| 76 | s.Name = "PortalScriptB" | |
| 77 | s.Parent = t | |
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | s = Instance.new("LocalScript")
| |
| 82 | s.Source = [[local Tool = script.Parent; | |
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | enabled = true | |
| 87 | ||
| 88 | function onButton1Down(mouse) | |
| 89 | targ = mouse.Target | |
| 90 | if (targ == nil) then return end | |
| 91 | if (targ.Name == "NoP") then | |
| 92 | script.Parent.Handle.failure:play() | |
| 93 | return | |
| 94 | end | |
| 95 | ||
| 96 | Hit = mouse.hit | |
| 97 | if Hit==nil then return end | |
| 98 | I = Instance.new("Part")
| |
| 99 | I.Parent = script.Parent.Parent | |
| 100 | I.CFrame = Hit | |
| 101 | I.Anchored = true | |
| 102 | I.CanCollide = false | |
| 103 | I.Shape = "Ball" | |
| 104 | I.Size = Vector3.new(4,4,4) | |
| 105 | I.Transparency = 0.5 | |
| 106 | I.Reflectance = 0.1 | |
| 107 | if (script.B.Value == true) then | |
| 108 | p = script.Parent.Parent:findFirstChild("PortalA")
| |
| 109 | if (p ~= nil) then p:remove() end | |
| 110 | I.BrickColor = BrickColor.Blue() | |
| 111 | I.Name = "PortalA" | |
| 112 | s = script.Parent.PortalScriptA:clone() | |
| 113 | s.Disabled = false | |
| 114 | s.Parent = I | |
| 115 | else | |
| 116 | p = script.Parent.Parent:findFirstChild("PortalB")
| |
| 117 | if (p ~= nil) then p:remove() end | |
| 118 | I.BrickColor = BrickColor.Red() | |
| 119 | I.Name = "PortalB" | |
| 120 | s = script.Parent.PortalScriptB:clone() | |
| 121 | s.Disabled = false | |
| 122 | s.Parent = I | |
| 123 | end | |
| 124 | script.B.Value = not script.B.Value | |
| 125 | ||
| 126 | script.Parent.Handle.fire:play() | |
| 127 | ||
| 128 | if not enabled then | |
| 129 | ||
| 130 | return | |
| 131 | ||
| 132 | end | |
| 133 | ||
| 134 | ||
| 135 | ||
| 136 | enabled = false | |
| 137 | ||
| 138 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
| 139 | ||
| 140 | ||
| 141 | ||
| 142 | wait(.3) | |
| 143 | ||
| 144 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
| 145 | ||
| 146 | enabled = true | |
| 147 | ||
| 148 | ||
| 149 | ||
| 150 | end | |
| 151 | ||
| 152 | ||
| 153 | ||
| 154 | function onEquippedLocal(mouse) | |
| 155 | ||
| 156 | ||
| 157 | ||
| 158 | if mouse == nil then | |
| 159 | ||
| 160 | print("Mouse not found")
| |
| 161 | ||
| 162 | return | |
| 163 | ||
| 164 | end | |
| 165 | ||
| 166 | ||
| 167 | ||
| 168 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
| 169 | ||
| 170 | mouse.Button1Down:connect(function() onButton1Down(mouse) end) | |
| 171 | ||
| 172 | end | |
| 173 | ||
| 174 | ||
| 175 | ||
| 176 | ||
| 177 | ||
| 178 | Tool.Equipped:connect(onEquippedLocal) | |
| 179 | ||
| 180 | ||
| 181 | ]] | |
| 182 | ||
| 183 | v = Instance.new("BoolValue")
| |
| 184 | v.Value = false | |
| 185 | v.Name = "B" | |
| 186 | v.Parent = s | |
| 187 | ||
| 188 | s.Name = "Local Gui" | |
| 189 | s.Parent = t | |
| 190 | ||
| 191 | ||
| 192 | --Removing this message or editing it's content is punishable by law. | |
| 193 | ||
| 194 | msg = Instance.new("Message")
| |
| 195 | msg.Text = "VolcanoINC's portal gun loaded for " .. receiver.Name | |
| 196 | msg.Parent = game.Workspace | |
| 197 | wait(3) | |
| 198 | msg.Parent = nil |