SHOW:
|
|
- or go back to the newest paste.
1 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
2 | -- call me maybe | |
3 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
4 | do | |
5 | print("FE Compatibility code by Mokiros") | |
6 | script.Parent = Player.Character | |
7 | ||
8 | --RemoteEvent for communicating | |
9 | local Event = Instance.new("RemoteEvent") | |
10 | Event.Name = "UserInput_Event" | |
11 | ||
12 | --Fake event to make stuff like Mouse.KeyDown work | |
13 | local function fakeEvent() | |
14 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} | |
15 | t.connect = t.Connect | |
16 | return t | |
17 | end | |
18 | ||
19 | --Creating fake input objects with fake variables | |
20 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} | |
21 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
22 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
23 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
24 | end} | |
25 | --Merged 2 functions into one by checking amount of arguments | |
26 | CAS.UnbindAction = CAS.BindAction | |
27 | ||
28 | --This function will trigger the events that have been :Connect()'ed | |
29 | local function te(self,ev,...) | |
30 | local t = m[ev] | |
31 | if t and t._fakeEvent and t.Function then | |
32 | t.Function(...) | |
33 | end | |
34 | end | |
35 | m.TrigEvent = te | |
36 | UIS.TrigEvent = te | |
37 | ||
38 | Event.OnServerEvent:Connect(function(plr,io) | |
39 | if plr~=Player then return end | |
40 | if io.isMouse then | |
41 | m.Target = io.Target | |
42 | m.Hit = io.Hit | |
43 | else | |
44 | local b = io.UserInputState == Enum.UserInputState.Begin | |
45 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
46 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
47 | end | |
48 | for _,t in pairs(CAS.Actions) do | |
49 | for _,k in pairs(t.Keys) do | |
50 | if k==io.KeyCode then | |
51 | t.Function(t.Name,io.UserInputState,io) | |
52 | end | |
53 | end | |
54 | end | |
55 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
56 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
57 | end | |
58 | end) | |
59 | Event.Parent = NLS([==[ | |
60 | local Player = game:GetService("Players").LocalPlayer | |
61 | local Event = script:WaitForChild("UserInput_Event") | |
62 | ||
63 | local UIS = game:GetService("UserInputService") | |
64 | local input = function(io,a) | |
65 | if a then return end | |
66 | --Since InputObject is a client-side instance, we create and pass table instead | |
67 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) | |
68 | end | |
69 | UIS.InputBegan:Connect(input) | |
70 | UIS.InputEnded:Connect(input) | |
71 | ||
72 | local Mouse = Player:GetMouse() | |
73 | local h,t | |
74 | --Give the server mouse data 30 times every second, but only if the values changed | |
75 | --If player is not moving their mouse, client won't fire events | |
76 | while wait(1/30) do | |
77 | if h~=Mouse.Hit or t~=Mouse.Target then | |
78 | h,t=Mouse.Hit,Mouse.Target | |
79 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
80 | end | |
81 | end]==],Player.Character) | |
82 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
83 | end | |
84 | plr = owner | |
85 | repeat wait() until plr.Character | |
86 | char = plr.Character | |
87 | ||
88 | -- Credit to shack for the anti death system | |
89 | ||
90 | local BODY = {} | |
91 | LeftArm = char["Left Arm"] | |
92 | RightLeg = char["Right Leg"] | |
93 | LeftLeg = char["Left Leg"] | |
94 | for _, c in pairs(char:GetDescendants()) do | |
95 | if c:IsA("BasePart") and c.Name ~= "Handle" then | |
96 | if c ~= char.HumanoidRootPart and c ~= char.Torso and c ~= char.Head and c ~= char["Right Arm"] and c ~= LeftArm and c ~= RightLeg and c ~= LeftLeg then | |
97 | c.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0) | |
98 | end | |
99 | table.insert(BODY,{c,c.Parent,c.Material,c.Color,c.Transparency}) | |
100 | elseif c:IsA("JointInstance") then | |
101 | table.insert(BODY,{c,c.Parent,nil,nil,nil}) | |
102 | end | |
103 | end | |
104 | for e = 1, #BODY do | |
105 | if BODY[e] ~= nil then | |
106 | local STUFF = BODY[e] | |
107 | local PART = STUFF[1] | |
108 | local PARENT = STUFF[2] | |
109 | local MATERIAL = STUFF[3] | |
110 | local COLOR = STUFF[4] | |
111 | local TRANSPARENCY = STUFF[5] | |
112 | if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then | |
113 | PART.Material = MATERIAL | |
114 | PART.Color = COLOR | |
115 | PART.Transparency = TRANSPARENCY | |
116 | end | |
117 | PART.AncestryChanged:Connect(function() | |
118 | PART.Parent = PARENT | |
119 | end) | |
120 | end | |
121 | end | |
122 | function refit() | |
123 | char.Parent = workspace | |
124 | for e = 1, #BODY do | |
125 | if BODY[e] ~= nil then | |
126 | local STUFF = BODY[e] | |
127 | local PART = STUFF[1] | |
128 | local PARENT = STUFF[2] | |
129 | local MATERIAL = STUFF[3] | |
130 | local COLOR = STUFF[4] | |
131 | local TRANSPARENCY = STUFF[5] | |
132 | if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then | |
133 | PART.Material = MATERIAL | |
134 | PART.Color = COLOR | |
135 | PART.Transparency = TRANSPARENCY | |
136 | end | |
137 | if PART.Parent ~= PARENT then | |
138 | char:FindFirstChildOfClass("Humanoid"):remove() | |
139 | PART.Parent = PARENT | |
140 | Humanoid = Instance.new("Humanoid",char) | |
141 | end | |
142 | end | |
143 | end | |
144 | end | |
145 | char.Humanoid.Died:connect(function() | |
146 | refit() | |
147 | end) | |
148 | local torso = Instance.new("SelectionBox",char) | |
149 | torso.Adornee = char.Torso | |
150 | local leftarm = Instance.new("SelectionBox",char) | |
151 | leftarm.Adornee = LeftArm | |
152 | local rightarm = Instance.new("SelectionBox",char) | |
153 | rightarm.Adornee = char["Right Arm"] | |
154 | local leftleg = Instance.new("SelectionBox",char) | |
155 | leftleg.Adornee = LeftLeg | |
156 | local rightleg = Instance.new("SelectionBox",char) | |
157 | rightleg.Adornee = char["Right Leg"] | |
158 | -- Color pallet | |
159 | green = "Lime green" | |
160 | red = "Really red" | |
161 | blue = "Electric blue" | |
162 | yellow = "New Yeller" | |
163 | violet = "Pastel violet" | |
164 | ||
165 | coroutine.wrap(function() | |
166 | while true do | |
167 | --boi | |
168 | do math.random(1,5) | |
169 | if 1 then | |
170 | wait(0.5) | |
171 | torso.Color3 = BrickColor.new(green).Color | |
172 | rightarm.Color3 = BrickColor.new(green).Color | |
173 | leftarm.Color3 = BrickColor.new(green).Color | |
174 | leftleg.Color3 = BrickColor.new(green).Color | |
175 | rightleg.Color3 = BrickColor.new(green).Color | |
176 | end | |
177 | if 2 then | |
178 | wait(0.5) | |
179 | torso.Color3 = BrickColor.new(red).Color | |
180 | rightarm.Color3 = BrickColor.new(red).Color | |
181 | leftarm.Color3 = BrickColor.new(red).Color | |
182 | leftleg.Color3 = BrickColor.new(red).Color | |
183 | rightleg.Color3 = BrickColor.new(red).Color | |
184 | end | |
185 | if 3 then | |
186 | wait(0.5) | |
187 | torso.Color3 = BrickColor.new(blue).Color | |
188 | rightarm.Color3 = BrickColor.new(blue).Color | |
189 | leftarm.Color3 = BrickColor.new(blue).Color | |
190 | leftleg.Color3 = BrickColor.new(blue).Color | |
191 | rightleg.Color3 = BrickColor.new(blue).Color | |
192 | end | |
193 | if 4 then | |
194 | wait(0.5) | |
195 | torso.Color3 = BrickColor.new(yellow).Color | |
196 | rightarm.Color3 = BrickColor.new(yellow).Color | |
197 | - | end)() |
197 | + | |
198 | leftleg.Color3 = BrickColor.new(yellow).Color | |
199 | rightleg.Color3 = BrickColor.new(yellow).Color | |
200 | end | |
201 | if 5 then | |
202 | wait(0.5) | |
203 | torso.Color3 = BrickColor.new(violet).Color | |
204 | rightarm.Color3 = BrickColor.new(violet).Color | |
205 | leftarm.Color3 = BrickColor.new(violet).Color | |
206 | leftleg.Color3 = BrickColor.new(violet).Color | |
207 | rightleg.Color3 = BrickColor.new(violet).Color | |
208 | end | |
209 | end | |
210 | end | |
211 | while true do | |
212 | wait() | |
213 | refit() | |
214 | char.Humanoid.Health = math.huge | |
215 | char.Humanoid.MaxHealth = math.huge | |
216 | end |