View difference between Paste ID: DJSkjUa8 and q9cJtFj9
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
1+
2-
local Player,game,owner = owner,game
2+
3-
local RealPlayer = Player
3+
4-
do
4+
5-
	print("FE Compatibility code by Mokiros")
5+
6-
	local rp = RealPlayer
6+
7-
	script.Parent = rp.Character
7+
8-
	
8+
9-
	--RemoteEvent for communicating
9+
10-
	local Event = Instance.new("RemoteEvent")
10+
11-
	Event.Name = "UserInput_Event"
11+
12
moozik.Looped = true
13-
	--Fake event to make stuff like Mouse.KeyDown work
13+
14-
	local function fakeEvent()
14+
15-
		local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
15+
16-
		t.connect = t.Connect
16+
17-
		return t
17+
18
19
20-
	--Creating fake input objects with fake variables
20+
21-
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
21+
22-
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
22+
23-
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
23+
24-
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
24+
25-
	end}
25+
26-
	--Merged 2 functions into one by checking amount of arguments
26+
27-
	CAS.UnbindAction = CAS.BindAction
27+
28
	local decal1 = Instance.new("Decal",block)
29-
	--This function will trigger the events that have been :Connect()'ed
29+
30-
	local function te(self,ev,...)
30+
31-
		local t = m[ev]
31+
32-
		if t and t._fakeEvent then
32+
33-
			for _,f in pairs(t.Functions) do
33+
34-
				f(...)
34+
35-
			end
35+
36
local decal5 = Instance.new("Decal",block)
37
decal5.Face = "Left"
38-
	m.TrigEvent = te
38+
39-
	UIS.TrigEvent = te
39+
40
damaged = false
41-
	Event.OnServerEvent:Connect(function(plr,io)
41+
42-
	    if plr~=rp then return end
42+
43-
		m.Target = io.Target
43+
44-
		m.Hit = io.Hit
44+
45-
		if not io.isMouse then
45+
46-
			local b = io.UserInputState == Enum.UserInputState.Begin
46+
47-
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
47+
48-
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
48+
49-
			end
49+
50-
			if io.UserInputType == Enum.UserInputType.MouseButton2 then
50+
51-
				return m:TrigEvent(b and "Button2Down" or "Button2Up")
51+
52-
			end
52+
53-
			for _,t in pairs(CAS.Actions) do
53+
54-
				for _,k in pairs(t.Keys) do
54+
55-
					if k==io.KeyCode then
55+
56-
						t.Function(t.Name,io.UserInputState,io)
56+
57-
					end
57+
58-
				end
58+
59-
			end
59+
60-
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
60+
61-
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
61+
62-
	    end
62+
63-
	end)
63+
64-
	Event.Parent = NLS([==[
64+
65-
	local Player = game:GetService("Players").LocalPlayer
65+
66-
	local Event = script:WaitForChild("UserInput_Event")
66+
67-
	local Mouse = Player:GetMouse()
67+
68-
	local UIS = game:GetService("UserInputService")
68+
69-
	local input = function(io,a)
69+
70-
		if a then return end
70+
71-
		--Since InputObject is a client-side instance, we create and pass table instead
71+
72-
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
72+
73
    decal1.Texture = top
74-
	UIS.InputBegan:Connect(input)
74+
75-
	UIS.InputEnded:Connect(input)
75+
76-
	local h,t
76+
77-
	--Give the server mouse data 30 times every second, but only if the values changed
77+
78-
	--If player is not moving their mouse, client won't fire events
78+
79-
	while wait(1/30) do
79+
80-
		if h~=Mouse.Hit or t~=Mouse.Target then
80+
81-
			h,t=Mouse.Hit,Mouse.Target
81+
82-
			Event:FireServer({isMouse=true,Target=t,Hit=h})
82+
83
tex2.Face = "Front"
84-
	end]==],Player.Character)
84+
85
tex3.Face = "Bottom"
86-
	----Sandboxed game object that allows the usage of client-side methods and services
86+
87-
	--Real game object
87+
88-
	local _rg = game
88+
89
tex5.Face = "Left"
90-
	--Metatable for fake service
90+
91-
	local fsmt = {
91+
92-
		__index = function(self,k)
92+
93-
			local s = rawget(self,"_RealService")
93+
94-
			if s then
94+
95-
				return typeof(s[k])=="function"
95+
96-
				and function(_,...)return s[k](s,...)end or s[k]
96+
97-
			end
97+
98-
		end,
98+
99-
		__newindex = function(self,k,v)
99+
100-
			local s = rawget(self,"_RealService")
100+
101-
			if s then s[k]=v end
101+
102
rhandweld.Part0 = char.Torso
103-
	}
103+
104-
	local function FakeService(t,RealService)
104+
105-
		t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
105+
106-
		return setmetatable(t,fsmt)
106+
107
human2.Part1 = char.Torso
108
human2co = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
109-
	--Fake game object
109+
110-
	local g = {
110+
111-
		GetService = function(self,s)
111+
112-
			return rawget(self,s) or _rg:GetService(s)
112+
113-
		end,
113+
114-
		Players = FakeService({
114+
115-
			LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
115+
116-
		},"Players"),
116+
117-
		UserInputService = FakeService(UIS,"UserInputService"),
117+
118-
		ContextActionService = FakeService(CAS,"ContextActionService"),
118+
119-
		RunService = FakeService({
119+
120-
			_btrs = {},
120+
121-
			RenderStepped = _rg:GetService("RunService").Heartbeat,
121+
122-
			BindToRenderStep = function(self,name,_,fun)
122+
123-
				self._btrs[name] = self.Heartbeat:Connect(fun)
123+
124-
			end,
124+
125-
			UnbindFromRenderStep = function(self,name)
125+
126-
				self._btrs[name]:Disconnect()
126+
127-
			end,
127+
128-
		},"RunService")
128+
129-
	}
129+
130-
	rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
130+
131-
	g.service = g.GetService
131+
132-
	FakeService(g,game)
132+
133-
	--Changing owner to fake player object to support owner:GetMouse()
133+
134-
	game,owner = g,g.Players.LocalPlayer
134+
135
	end
136
	if whattype == "OakWood" then
137
		changeyourblockdecal("http://www.roblox.com/asset/?id=55355773","http://www.roblox.com/asset/?id=55355773","http://www.roblox.com/asset/?id=55319786","http://www.roblox.com/asset/?id=55319786","http://www.roblox.com/asset/?id=55319786","http://www.roblox.com/asset/?id=55319786")
138
	end
139
	if whattype == "GoldOre" then
140
		changeyourblockdecal("http://www.roblox.com/asset/?id=73374646","http://www.roblox.com/asset/?id=73374646","http://www.roblox.com/asset/?id=73374646","http://www.roblox.com/asset/?id=73374646","http://www.roblox.com/asset/?id=73374646","http://www.roblox.com/asset/?id=73374646")
141
	end
142
	if whattype == "Sponge" then
143
		changeyourblockdecal("http://www.roblox.com/asset/?id=38945383","http://www.roblox.com/asset/?id=38945383","http://www.roblox.com/asset/?id=38945383","http://www.roblox.com/asset/?id=38945383","http://www.roblox.com/asset/?id=38945383","http://www.roblox.com/asset/?id=38945383")
144
	end
145
end
146
147
changeblocktype("Grass")
148
149
150
151
function playanim(whatanim,speed)
152
	if whatanim == "Place" then
153
		rhandweld.Parent = char.Torso
154
		for i = 0,1, speed do
155
			rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(1.5, 0.473864555, -0.788700104, 1, 0, 0, 0, -0.0214149933, -0.999770641, 0, 0.999770641, -0.0214149933),i)
156
			game:GetService("RunService").RenderStepped:wait()
157
		end
158
		for i = 0,1, speed do
159
			rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(0.957962036, 0.0477108955, -1.06759644, 0.445479125, 0.728770554, 0.520040333, 0.0191690028, 0.572963655, -0.81935662, -0.895087242, 0.374974847, 0.241273522),i)
160
			game:GetService("RunService").RenderStepped:wait()
161
		end
162
	end
163
	if whatanim == "Destroy" then
164
		rhandweld.Parent = char.Torso
165
		for i = 0,1, speed do
166
			rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(1.5, 0.473864555, -0.788700104, 1, 0, 0, 0, -0.0214149933, -0.999770641, 0, 0.999770641, -0.0214149933),i)
167
			game:GetService("RunService").RenderStepped:wait()
168
		end
169
		for i = 0,1, speed do
170
			rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(0.957962036, 0.0477108955, -1.06759644, 0.445479125, 0.728770554, 0.520040333, 0.0191690028, 0.572963655, -0.81935662, -0.895087242, 0.374974847, 0.241273522),i)
171
			game:GetService("RunService").RenderStepped:wait()
172
		end
173
	end
174
	if whatanim == "NormalPose" then
175
		for i = 0,1 , speed do
176
			rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(1.5, 0, 0, 1, -1.6395192e-43, 0, -1.6395192e-43, 1, 0, 0, 0, 1),i)
177
			game:GetService("RunService").RenderStepped:wait()
178
		end
179
	end
180
end
181
canuse = true
182
mouse = plr:GetMouse()
183
function buildblock()
184
	if canuse then
185
	canuse = false
186
	playanim("Place", 0.07)
187
	local theactualblock = Instance.new("Part")
188
	theactualblock:BreakJoints()
189
	theactualblock.Parent = workspace
190
	theactualblock.Transparency = 0
191
	theactualblock.CFrame = mouse.Hit + Vector3.new(0,1.09,0)
192
	theactualblock.Orientation = Vector3.new(0,0,0)
193
	theactualblock.Size = Vector3.new(3,3,3)
194
	theactualblock.Anchored = true
195
	theactualblock.CanCollide = true
196
	theactualblock.Name = "BlockPlace"
197
	changeblockdecal(theactualblock,decal3.Texture, decal1.Texture, decal5.Texture,decal6.Texture, decal4.Texture, decal2.Texture)
198
    playanim("NormalPose", 0.3)
199
	canuse = true
200
	end
201
end
202
function destroyblock()
203
	if mouse.Target.Name == "BlockPlace" and mouse.Target.Name ~= "Base" and mouse.Target.Name ~= "Baseplate" and mouse.Target.Name ~= "Workspace" then
204
		playanim("Destroy", 0.07)
205
		mouse.Target:Destroy()
206
        playanim("NormalPose", 0.3)
207
	end
208
end
209
local mouse1 = mouse.Button1Down:connect(function()
210
	buildblock()
211
end)
212
local mouse2 = mouse.KeyDown:connect(function(k)
213
	if k == "q" then
214
		destroyblock()
215
	end
216
	if k == "e" then
217
		local chance = math.random(1,11)
218
		if chance == 1 then
219
			changeblocktype("Grass")
220
		end
221
		if chance == 2 then
222
			changeblocktype("Dirt")
223
		end
224
		if chance == 3 then
225
			changeblocktype("Cobblestone")
226
		end
227
		if chance == 4 then
228
			changeblocktype("Gold")
229
		end
230
		if chance == 5 then
231
			changeblocktype("Stone")
232
		end
233
		if chance == 6 then
234
			changeblocktype("DiamondBlock")
235
		end
236
		if chance == 7 then
237
			changeblocktype("DiamondOre")
238
		end
239
		if chance == 8 then
240
			changeblocktype("WoodenPlank")
241
		end
242
		if chance == 9 then
243
			changeblocktype("OakWood")
244
		end
245
		if chance == 10 then
246
			changeblocktype("GoldOre")
247
		end
248
		if chance == 11 then
249
			changeblocktype("Sponge")
250
		end
251
	end
252
end)
253
HasDied = false
254
Dead = false
255
local reddeath = function()
256
    for i,v in pairs(char:GetChildren()) do
257
    if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then
258
        local cp = v:Clone()
259
        cp.Parent = effect     
260
        cp.BrickColor = BrickColor.new("Really red")
261
        cp.Transparency = 1
262
        cp.CanCollide = false
263
        cp.Material = Enum.Material.Neon
264
        if cp.Name == "Head" then
265
            cp.face:Destroy()
266
        end
267
        if cp.Name == "Torso" then
268
            cp.roblox:Destroy()
269
        end
270
        if v ~= char.Head then
271
            cp.Size = v.Size+(Vector3.new(1,1,1)*0.2)
272
        else
273
            cp.Size = (Vector3.new(1,1,1)*v.Size.Y)+(Vector3.new(1,1,1)*0.2)
274
        end
275
        local weld = Instance.new("Weld",cp)
276
        weld.Part0 = v
277
        weld.Part1 = cp
278
         end
279
    end
280
end
281
reddeath()
282
generategui = function()
283
local screen = Instance.new("ScreenGui",plr.PlayerGui)
284
screen.Name = "Death(lol i was lazy to add buttons lol)"
285
local text = Instance.new("TextLabel",screen)
286
text.Text = "You died!"
287
text.TextColor3 = Color3.new(1,1,1)
288
text.Font = "Arcade"
289
text.TextScaled = true
290
text.Position = UDim2.new(0.381, 0,0.172, 0)
291
text.Size = UDim2.new(0, 200, 0, 50)
292
text.BackgroundTransparency = 1
293
local respawn = Instance.new("TextButton",screen)
294
respawn.Text = "Respawn"
295
respawn.TextScaled = true
296
respawn.Position = UDim2.new(0.381, 0,0.561, 0)
297
respawn.Size = UDim2.new(0, 200,0, 50)
298
respawn.BackgroundTransparency = 1
299
respawn.TextColor3 = Color3.new(1,1,1)
300
respawn.Font = "Arcade"
301
respawn.MouseButton1Click:connect(function()
302
    Dead = false
303
    HasDied = false
304
    char.Humanoid.Health = 0
305
    char.Parent = nil
306
    respawn.Text = "Say g/r or g/sr to respawn properly"
307
    end)
308
end
309
local BODY = {}
310
LeftArm = char["Left Arm"]
311
RightLeg = char["Right Leg"]
312
LeftLeg = char["Left Leg"]
313
for _, c in pairs(char:GetDescendants()) do
314
    if c:IsA("BasePart") and c.Name ~= "Handle" then
315
        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
316
            c.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
317
        end
318
        table.insert(BODY,{c,c.Parent,c.Material,c.Color,c.Transparency})
319
    elseif c:IsA("JointInstance") then
320
        table.insert(BODY,{c,c.Parent,nil,nil,nil})
321
    end
322
end
323
for e = 1, #BODY do
324
    if BODY[e] ~= nil then
325
        local STUFF = BODY[e]
326
        local PART = STUFF[1]
327
        local PARENT = STUFF[2]
328
        local MATERIAL = STUFF[3]
329
        local TRANSPARENCY = STUFF[5]
330
        if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then
331
            PART.Material = MATERIAL
332
            PART.Transparency = TRANSPARENCY
333
        end
334
        PART.AncestryChanged:Connect(function()
335
            PART.Parent = PARENT
336
        end)
337
    end
338
end
339
function refit()
340
   char.Parent = workspace
341
    for e = 1, #BODY do
342
        if BODY[e] ~= nil then
343
            local STUFF = BODY[e]
344
            local PART = STUFF[1]
345
            local PARENT = STUFF[2]
346
            local MATERIAL = STUFF[3]
347
            local TRANSPARENCY = STUFF[5]
348
            if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then
349
                PART.Material = MATERIAL
350
                PART.Transparency = TRANSPARENCY
351
            end
352
            if PART.Parent ~= PARENT then
353
                char:FindFirstChildOfClass("Humanoid"):remove()
354
                PART.Parent = PARENT
355
                Humanoid = Instance.new("Humanoid",char)
356
            end
357
        end
358
    end
359
end
360
char.Humanoid.Died:connect(function()
361
    hurt:Play()
362
    refit()
363
    mouse1:Disconnect()
364
    mouse2:Disconnect()
365
    for i,v in pairs(effect:GetChildren()) do
366
      if v.ClassName == "Part" then  
367
        v.Transparency = 0.7
368
        end
369
    end
370
    workspace.CurrentCamera.CameraSubject = char.Head
371
    generategui()
372
    HasDied = true
373
    Dead = true
374
    for i = 0,1, 0.03 do
375
    human2.C0 = human2.C0:lerp(CFrame.new(1.99999964, -3.00000095, 0, -0.00852799695, 0.999963641, 0, -0.999963641, -0.00852799695, 0, 0, 0, 1):inverse() + Vector3.new(0,1,0),i)
376
    game:GetService("RunService").RenderStepped:wait()
377
    end
378
end)
379
while true do
380
	game:GetService("RunService").RenderStepped:wait()
381
	if char.Humanoid.Health < 100 and not damaged and not Dead and not HasDied then
382
		reddamage(0.5)
383
		damaged = true
384
		wait(1)
385
		damaged = false
386
		char.Humanoid.Health = 100
387
	end
388
	if char.Humanoid.Health < 1 and Dead and HasDied then
389
		refit()
390
		  for i,v in pairs(effect:GetChildren()) do
391
      if v.ClassName == "Part" then  
392
        v.Transparency = 0.7
393
            end
394
        end
395
	end
396
	if Dead and HasDied then
397
		char.Humanoid.WalkSpeed = 0
398
		char.Humanoid.JumpPower = 0
399
        human2.Parent = char.Torso
400
        rhandweld.Parent = char.Torso
401
	end
402
end