View difference between Paste ID: wj5GfbHJ and FUZJAGK0
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
6
    print("FE Compatibility code V2 by Mokiros")
7
    local RealPlayer = RealPlayer
8
    script.Parent = RealPlayer.Character
9
 
10
    --Fake event to make stuff like Mouse.KeyDown work
11
    local Disconnect_Function = function(this)
12
        this[1].Functions[this[2]] = nil
13
    end
14
    local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
15
    local FakeEvent_Metatable = {__index={
16
        Connect = function(this,f)
17
            local i = tostring(math.random(0,10000))
18
            while this.Functions[i] do
19
                i = tostring(math.random(0,10000))
20
            end
21
            this.Functions[i] = f
22
            return setmetatable({this,i},Disconnect_Metatable)
23
        end
24
    }}
25
    FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
26
    local function fakeEvent()
27
        return setmetatable({Functions={}},FakeEvent_Metatable)
28
    end
29
 
30
    --Creating fake input objects with fake variables
31
    local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
32
    FakeMouse.keyUp = FakeMouse.KeyUp
33
    FakeMouse.keyDown = FakeMouse.KeyDown
34
    local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
35
    local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
36
        CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
37
    end}
38
    --Merged 2 functions into one by checking amount of arguments
39
    CAS.UnbindAction = CAS.BindAction
40
 
41
    --This function will trigger the events that have been :Connect()'ed
42
    local function TriggerEvent(self,ev,...)
43
        for _,f in pairs(self[ev].Functions) do
44
            f(...)
45
        end
46
    end
47
    FakeMouse.TriggerEvent = TriggerEvent
48
    UIS.TriggerEvent = TriggerEvent
49
 
50
    --Client communication
51
    local Event = Instance.new("RemoteEvent")
52
    Event.Name = "UserInput_Event"
53
    Event.OnServerEvent:Connect(function(plr,io)
54
        if plr~=RealPlayer then return end
55
        FakeMouse.Target = io.Target
56
        FakeMouse.Hit = io.Hit
57
        if not io.isMouse then
58
            local b = io.UserInputState == Enum.UserInputState.Begin
59
            if io.UserInputType == Enum.UserInputType.MouseButton1 then
60
                return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
61
            end
62
            if io.UserInputType == Enum.UserInputType.MouseButton2 then
63
                return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
64
            end
65
            for _,t in pairs(CAS.Actions) do
66
                for _,k in pairs(t.Keys) do
67
                    if k==io.KeyCode then
68
                        t.Function(t.Name,io.UserInputState,io)
69
                    end
70
                end
71
            end
72
            FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
73
            UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
74
        end
75
    end)
76
    Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
77
    local Mouse = owner:GetMouse()
78
    local UIS = game:GetService("UserInputService")
79
    local input = function(io,RobloxHandled)
80
        if RobloxHandled then return end
81
        --Since InputObject is a client-side instance, we create and pass table instead
82
        Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
83
    end
84
    UIS.InputBegan:Connect(input)
85
    UIS.InputEnded:Connect(input)
86
    local h,t
87
    --Give the server mouse data every second frame, but only if the values changed
88
    --If player is not moving their mouse, client won't fire events
89
    local HB = game:GetService("RunService").Heartbeat
90
    while true do
91
        if h~=Mouse.Hit or t~=Mouse.Target then
92
            h,t=Mouse.Hit,Mouse.Target
93
            Event:FireServer({isMouse=true,Target=t,Hit=h})
94
        end
95
        --Wait 2 frames
96
        for i=1,2 do
97
            HB:Wait()
98
        end
99
    end]==],script)
100
 
101
    ----Sandboxed game object that allows the usage of client-side methods and services
102
    --Real game object
103
    local RealGame = game
104
 
105
    --Metatable for fake service
106
    local FakeService_Metatable = {
107
        __index = function(self,k)
108
            local s = rawget(self,"_RealService")
109
            if s then
110
                return typeof(s[k])=="function"
111
                and function(_,...)return s[k](s,...)end or s[k]
112
            end
113
        end,
114
        __newindex = function(self,k,v)
115
            local s = rawget(self,"_RealService")
116
            if s then s[k]=v end
117
        end
118
    }
119
    local function FakeService(t,RealService)
120
        t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
121
        return setmetatable(t,FakeService_Metatable)
122
    end
123
 
124
    --Fake game object
125
    local FakeGame = {
126
        GetService = function(self,s)
127
            return rawget(self,s) or RealGame:GetService(s)
128
        end,
129
        Players = FakeService({
130
            LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
131
        },"Players"),
132
        UserInputService = FakeService(UIS,"UserInputService"),
133
        ContextActionService = FakeService(CAS,"ContextActionService"),
134
        RunService = FakeService({
135
            _btrs = {},
136
            RenderStepped = RealGame:GetService("RunService").Heartbeat,
137
            BindToRenderStep = function(self,name,_,fun)
138
                self._btrs[name] = self.Heartbeat:Connect(fun)
139
            end,
140
            UnbindFromRenderStep = function(self,name)
141
                self._btrs[name]:Disconnect()
142
            end,
143
        },"RunService")
144
    }
145
    rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
146
    FakeGame.service = FakeGame.GetService
147
    FakeService(FakeGame,game)
148
    --Changing owner to fake player object to support owner:GetMouse()
149
    game,owner = FakeGame,FakeGame.Players.LocalPlayer
150
end
151
 
152-
--SCRIPT
152+
--END OF CONVERT
153
154
--Variables
155
local ups = game:GetService("UserInputService")
156
local playersservice = game:GetService("Players")
157
local debris = game:GetService("Debris")
158
local tweenservice = game:GetService("TweenService")
159
 
160
local player = game.Players.LocalPlayer
161
local char = player.Character
162
local mouse = player:GetMouse()
163
local primarypart = char.PrimaryPart
164
local head = char.Head
165
local humanoid = char.Humanoid
166-
            local target = mouse.Target
166+
167-
            if target then
167+
local crystalspiketweeninfo = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
168-
                local thumanoid = target.Parent:FindFirstChild("Humanoid")
168+
local borbtweeninfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
169-
                if thumanoid then
169+
170-
                    
170+
--Code
171
172
script.Name = "Void"
173
script.Parent = player.PlayerGui
174
175
--Initilize
176
177
if not char:FindFirstChild("Torso") then
178
	print("Use R6 nerd")
179
end
180
181
for i,v in pairs(char:GetChildren()) do
182
	if v:IsA("Part") then
183
		v.Material = "Glass"
184
		v.Color = Color3.fromRGB(255,78,128)
185
		v.Reflectance = 0.5
186
	elseif v:IsA("Accessory") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("ShirtGraphic") or v:IsA("CharacterMesh") then
187
		v:Destroy()
188
	end
189
end
190
if head:FindFirstChild("face") then
191
	head.face:Destroy()
192
end
193
if head:FindFirstChild("Mesh") then
194
	head.Mesh:Destroy()
195
end
196
197
humanoid.MaxHealth = math.huge
198
humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
199
local newface = Instance.new("Texture")
200
newface.Texture = "http://www.roblox.com/asset/?id=4221202944"
201
newface.Parent = head
202
local ff = Instance.new("ForceField")
203
ff.Visible = false
204
ff.Parent = char
205
206
--Functions
207
208
function crystalspiketouched(hit)
209
	local thumanoid = hit.Parent:FindFirstChild("Humanoid")
210
	if thumanoid and thumanoid ~= humanoid then
211
		thumanoid.Health = thumanoid.Health-(5+thumanoid.Health/7)
212
		thumanoid.Sit = true
213
		for i,v in pairs(thumanoid.Parent:GetChildren()) do
214
			if v:IsA("BasePart") then
215
				v.Velocity = Vector3.new(math.random(-25,25), math.random(100,250), math.random(-25,25))
216
			end
217
		end
218
	end
219
end
220
221
--Input stuff
222
223
ups.InputBegan:connect(function(inputObject, gameProcessedEvent)
224
    if not gameProcessedEvent then
225
        if inputObject.KeyCode == Enum.KeyCode.R then
226
			if mouse.Target then
227
				local hit = mouse.Hit.Position
228
				local crystalparts = {}
229
				
230
				local function createcrystal(newsize, neworientation)
231
					local p = Instance.new("Part")
232
					p.Name = "Crystal"
233
					p.Color = Color3.fromRGB(255,78,128)
234
					p.Reflectance = 0.5
235
					p.Material = "Glass"
236
					p.Anchored = true
237
					p.Position = hit
238
					p.Size = Vector3.new(0,0,0)
239
					p.Orientation = neworientation
240
					p.Parent = workspace
241
					table.insert(crystalparts, p)
242
					
243
					local newtween = tweenservice:Create(p, crystalspiketweeninfo, {["Size"] = newsize})
244
					newtween:Play()
245
246
					p.Touched:Connect(crystalspiketouched)
247
				end
248
249
				createcrystal(Vector3.new(5,50,5), Vector3.new(0,0,0))
250
				
251
				for i = 1,5 do
252
					local thisnewsizexz = math.random(1,5)
253
					createcrystal(
254
						Vector3.new(thisnewsizexz, math.random(1,40), thisnewsizexz), 
255
						Vector3.new(math.random(-45,45), math.random(1,180), math.random(-45,45))
256
					)
257
				end
258
259
				wait(5)
260
261
				for i,v in pairs(crystalparts) do
262
					local newtween = tweenservice:Create(v, crystalspiketweeninfo, {["Size"] = Vector3.new(0,0,0)})
263
					newtween:Play()
264
					
265
					newtween.Completed:Connect(function()
266
						--tween:Destroy()
267
						v:Destroy()
268
					end)
269
				end
270
			end
271
		elseif inputObject.KeyCode == Enum.KeyCode.F then
272
			if mouse.Target then
273
				local parts = {}
274
				
275
				local hit = mouse.Hit.Position
276
				for i,v in pairs(char:GetChildren()) do
277
					if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
278
						table.insert(parts, v)
279
						v.Transparency = 1
280
					end
281
				end
282
	
283
				local p = Instance.new("Part")
284
				p.Name = "Crystal"
285
				p.Color = Color3.fromRGB(255,78,128)
286
				p.Size = Vector3.new(2,2,2)
287
				p.Position = primarypart.Position + Vector3.new(0, -3.5, 0)
288
				p.Shape = "Ball"
289
				p.Reflectance = 0.5
290
				p.Material = "Glass"
291
				p.Anchored = true
292
				p.Parent = workspace
293
				
294
				local newtween = tweenservice:Create(p, borbtweeninfo, {["Position"] = hit})
295
				newtween:Play()
296
				
297
				newtween.Completed:Connect(function()
298
					if p then
299
						p:Destroy()
300
					end
301
					for i,v in pairs(parts) do
302
						v.Transparency = 0
303
					end
304
					char.HumanoidRootPart.CFrame = CFrame.new(hit)
305
				end)
306
			end
307
		end
308
	end
309
end)
310
311
ups.InputEnded:connect(function(inputObject, gameProcessedEvent)
312
    if not gameProcessedEvent then
313
        if inputObject.KeyCode == Enum.KeyCode.R then
314
			
315
        end
316
	end
317
end)