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 | - | player = game.Players.PutYourNameHere |
6 | + | |
7 | - | workspacePlayer = game.Workspace.PutYourNameHere |
7 | + | |
8 | --Created by DJwaffle2005-- | |
9 | --------------------------- | |
10 | wait(0.1) | |
11 | ||
12 | player = game.Players.kitty_vat9 | |
13 | workspacePlayer = game.Workspace.kitty_vat9 | |
14 | ||
15 | local ff = Instance.new("ForceField") --Creates forcefield | |
16 | ff.Parent = workspacePlayer | |
17 | ||
18 | workspacePlayer.Humanoid.WalkSpeed = 30 | |
19 | ||
20 | local tool1 = Instance.new("HopperBin") --Gives the player a grab tool. | |
21 | tool1.Name = "Grab" | |
22 | tool1.Parent = player.Backpack | |
23 | tool1.BinType = "Grab" | |
24 | print("Gave grab tool") | |
25 | ||
26 | local tool2 = Instance.new("HopperBin") --Gives the player a clone tool. | |
27 | tool2.Name = "Clone" | |
28 | tool2.Parent = player.Backpack | |
29 | tool2.BinType = "Clone" | |
30 | print("Gave clone tool") | |
31 | ||
32 | local tool3 = Instance.new("HopperBin") --Gives the player a destroy tool. | |
33 | tool3.Name = "Hammer" | |
34 | tool3.Parent = player.Backpack | |
35 | tool3.BinType = "Hammer" | |
36 | print("Gave delete tool") | |
37 | ||
38 | local tool4 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
39 | tool4.Name = "New Part" | |
40 | tool4.Parent = player.Backpack | |
41 | tool4.BinType = "Script" | |
42 | print("Gave new part tool") | |
43 | ||
44 | local tool5 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
45 | tool5.Name = "Paint" | |
46 | tool5.Parent = player.Backpack | |
47 | tool5.BinType = "Script" | |
48 | print("Gave paint tool") | |
49 | ||
50 | local tool6 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
51 | tool6.Name = "Anchor" | |
52 | tool6.Parent = player.Backpack | |
53 | tool6.BinType = "Script" | |
54 | print("Gave anchor tool") | |
55 | ||
56 | local tool7 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
57 | tool7.Name = "Un-Anchor" | |
58 | tool7.Parent = player.Backpack | |
59 | tool7.BinType = "Script" | |
60 | print("Gave un-anchor tool") | |
61 | ||
62 | local tool8 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
63 | tool8.Name = "Lock" | |
64 | tool8.Parent = player.Backpack | |
65 | tool8.BinType = "Script" | |
66 | print("Gave lock tool") | |
67 | ||
68 | local tool9 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
69 | tool9.Name = "Unlock" | |
70 | tool9.Parent = player.Backpack | |
71 | tool9.BinType = "Script" | |
72 | print("Gave unlock tool") | |
73 | ||
74 | playerMouse = game.Players.LocalPlayer:GetMouse() | |
75 | ||
76 | ||
77 | --Functions-- | |
78 | function lock() | |
79 | playerMouse.Target.Locked = true | |
80 | print("Locked "..playerMouse.Target.Name) | |
81 | end | |
82 | ||
83 | function unlock() | |
84 | playerMouse.Target.Locked = false | |
85 | print("Unlocked "..playerMouse.Target.Name) | |
86 | end | |
87 | ||
88 | function anchor() | |
89 | playerMouse.Target.Anchored = true | |
90 | print("Anchored "..playerMouse.Target.Name) | |
91 | end | |
92 | ||
93 | function unanchor() | |
94 | playerMouse.Target.Anchored = false | |
95 | print("Un-anchored "..playerMouse.Target.Name) | |
96 | end | |
97 | ||
98 | function paint() | |
99 | playerMouse.Target.BrickColor = BrickColor.Random() | |
100 | end | |
101 | ||
102 | function create(mouse) | |
103 | local part = Instance.new("Part") | |
104 | part.Parent = game.Workspace | |
105 | part.Position = player.Head.Position | |
106 | part.Anchored = true | |
107 | part.Locked = false | |
108 | print("Created a new part.") | |
109 | end | |
110 | ||
111 | ------------------------ | |
112 | ||
113 | --Events- | |
114 | ||
115 | tool4.Selected:connect(function(mouse) | |
116 | print("Selected.") | |
117 | mouse.Button1Down:connect(create) | |
118 | end) | |
119 | ||
120 | tool5.Selected:connect(function(mouse) | |
121 | print("Selected.") | |
122 | mouse.Button1Down:connect(paint) | |
123 | end) | |
124 | ||
125 | tool6.Selected:connect(function(mouse) | |
126 | print("Selected.") | |
127 | mouse.Button1Down:connect(anchor) | |
128 | end) | |
129 | ||
130 | tool7.Selected:connect(function(mouse) | |
131 | print("Selected.") | |
132 | mouse.Button1Down:connect(unanchor) | |
133 | end) | |
134 | ||
135 | tool8.Selected:connect(function(mouse) | |
136 | print("Selected.") | |
137 | mouse.Button1Down:connect(lock) | |
138 | end) | |
139 | ||
140 | tool9.Selected:connect(function(mouse) | |
141 | print("Selected.") | |
142 | mouse.Button1Down:connect(unlock) | |
143 | end) | |
144 | ||
145 | print("Gave tools to "..player.Name..".") |