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