SHOW:
|
|
- or go back to the newest paste.
1 | - | --------------------------- |
1 | + | --]] |
2 | - | --Created by DJwaffle2005-- |
2 | + | --https://github.com/Mokiros/roblox-FE-compatibility |
3 | - | --------------------------- |
3 | + | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end |
4 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
5 | local RealPlayer = Player | |
6 | - | player = game.Players.PutYourNameHere |
6 | + | do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end |
7 | - | workspacePlayer = game.Workspace.PutYourNameHere |
7 | + | |
8 | ||
9 | wait(0.1) | |
10 | ||
11 | player = game.Players.lolfarmer | |
12 | workspacePlayer = game.Workspace.lolfarmer | |
13 | ||
14 | local ff = Instance.new("ForceField") --Creates forcefield | |
15 | ff.Parent = workspacePlayer | |
16 | ||
17 | workspacePlayer.Humanoid.WalkSpeed = 30 | |
18 | ||
19 | local tool1 = Instance.new("HopperBin") --Gives the player a grab tool. | |
20 | tool1.Name = "Grab" | |
21 | tool1.Parent = player.Backpack | |
22 | tool1.BinType = "Grab" | |
23 | print("Gave grab tool") | |
24 | ||
25 | local tool2 = Instance.new("HopperBin") --Gives the player a clone tool. | |
26 | tool2.Name = "Clone" | |
27 | tool2.Parent = player.Backpack | |
28 | tool2.BinType = "Clone" | |
29 | print("Gave clone tool") | |
30 | ||
31 | local tool3 = Instance.new("HopperBin") --Gives the player a destroy tool. | |
32 | tool3.Name = "Hammer" | |
33 | tool3.Parent = player.Backpack | |
34 | tool3.BinType = "Hammer" | |
35 | print("Gave delete tool") | |
36 | ||
37 | local tool4 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
38 | tool4.Name = "New Part" | |
39 | tool4.Parent = player.Backpack | |
40 | tool4.BinType = "Script" | |
41 | print("Gave new part tool") | |
42 | ||
43 | local tool5 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
44 | tool5.Name = "Paint" | |
45 | tool5.Parent = player.Backpack | |
46 | tool5.BinType = "Script" | |
47 | print("Gave paint tool") | |
48 | ||
49 | local tool6 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
50 | tool6.Name = "Anchor" | |
51 | tool6.Parent = player.Backpack | |
52 | tool6.BinType = "Script" | |
53 | print("Gave anchor tool") | |
54 | ||
55 | local tool7 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
56 | tool7.Name = "Un-Anchor" | |
57 | tool7.Parent = player.Backpack | |
58 | tool7.BinType = "Script" | |
59 | print("Gave un-anchor tool") | |
60 | ||
61 | local tool8 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
62 | tool8.Name = "Lock" | |
63 | tool8.Parent = player.Backpack | |
64 | tool8.BinType = "Script" | |
65 | print("Gave lock tool") | |
66 | ||
67 | local tool9 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part. | |
68 | tool9.Name = "Unlock" | |
69 | tool9.Parent = player.Backpack | |
70 | tool9.BinType = "Script" | |
71 | print("Gave unlock tool") | |
72 | ||
73 | playerMouse = game.Players.LocalPlayer:GetMouse() | |
74 | ||
75 | ||
76 | --Functions-- | |
77 | function lock() | |
78 | playerMouse.Target.Locked = true | |
79 | print("Locked "..playerMouse.Target.Name) | |
80 | end | |
81 | ||
82 | function unlock() | |
83 | playerMouse.Target.Locked = false | |
84 | print("Unlocked "..playerMouse.Target.Name) | |
85 | end | |
86 | ||
87 | function anchor() | |
88 | playerMouse.Target.Anchored = true | |
89 | print("Anchored "..playerMouse.Target.Name) | |
90 | end | |
91 | ||
92 | function unanchor() | |
93 | playerMouse.Target.Anchored = false | |
94 | print("Un-anchored "..playerMouse.Target.Name) | |
95 | end | |
96 | ||
97 | function paint() | |
98 | playerMouse.Target.BrickColor = BrickColor.Random() | |
99 | end | |
100 | ||
101 | function create(mouse) | |
102 | local part = Instance.new("Part") | |
103 | part.Parent = game.Workspace | |
104 | part.Position = player.Head.Position | |
105 | part.Anchored = true | |
106 | part.Locked = false | |
107 | print("Created a new part.") | |
108 | end | |
109 | ||
110 | ------------------------ | |
111 | ||
112 | --Events- | |
113 | ||
114 | tool4.Selected:connect(function(mouse) | |
115 | print("Selected.") | |
116 | mouse.Button1Down:connect(create) | |
117 | end) | |
118 | ||
119 | tool5.Selected:connect(function(mouse) | |
120 | print("Selected.") | |
121 | mouse.Button1Down:connect(paint) | |
122 | end) | |
123 | ||
124 | tool6.Selected:connect(function(mouse) | |
125 | print("Selected.") | |
126 | mouse.Button1Down:connect(anchor) | |
127 | end) | |
128 | ||
129 | tool7.Selected:connect(function(mouse) | |
130 | print("Selected.") | |
131 | mouse.Button1Down:connect(unanchor) | |
132 | end) | |
133 | ||
134 | tool8.Selected:connect(function(mouse) | |
135 | print("Selected.") | |
136 | mouse.Button1Down:connect(lock) | |
137 | end) | |
138 | ||
139 | tool9.Selected:connect(function(mouse) | |
140 | print("Selected.") | |
141 | mouse.Button1Down:connect(unlock) | |
142 | end) | |
143 | ||
144 | print("Gave tools to "..player.Name..".") |