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 | - | local Player,Mouse,mouse,UserInputService,ContextActionService = owner |
| 2 | + | local Player,game,owner = owner,game |
| 3 | local RealPlayer = Player | |
| 4 | do | |
| 5 | - | script.Parent = Player.Character |
| 5 | + | |
| 6 | local rp = RealPlayer | |
| 7 | script.Parent = rp.Character | |
| 8 | ||
| 9 | --RemoteEvent for communicating | |
| 10 | local Event = Instance.new("RemoteEvent")
| |
| 11 | Event.Name = "UserInput_Event" | |
| 12 | ||
| 13 | - | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
|
| 13 | + | |
| 14 | local function fakeEvent() | |
| 15 | local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
| |
| 16 | t.connect = t.Connect | |
| 17 | return t | |
| 18 | end | |
| 19 | ||
| 20 | --Creating fake input objects with fake variables | |
| 21 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 22 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 23 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 24 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 25 | end} | |
| 26 | --Merged 2 functions into one by checking amount of arguments | |
| 27 | CAS.UnbindAction = CAS.BindAction | |
| 28 | ||
| 29 | --This function will trigger the events that have been :Connect()'ed | |
| 30 | - | if t and t._fakeEvent and t.Function then |
| 30 | + | |
| 31 | - | t.Function(...) |
| 31 | + | |
| 32 | if t and t._fakeEvent then | |
| 33 | for _,f in pairs(t.Functions) do | |
| 34 | f(...) | |
| 35 | end | |
| 36 | end | |
| 37 | end | |
| 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 | + | if plr~=rp then return end |
| 43 | m.Target = io.Target | |
| 44 | m.Hit = io.Hit | |
| 45 | if not io.isMouse then | |
| 46 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 47 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 48 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 49 | end | |
| 50 | for _,t in pairs(CAS.Actions) do | |
| 51 | for _,k in pairs(t.Keys) do | |
| 52 | if k==io.KeyCode then | |
| 53 | t.Function(t.Name,io.UserInputState,io) | |
| 54 | end | |
| 55 | end | |
| 56 | end | |
| 57 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 58 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 59 | end | |
| 60 | end) | |
| 61 | Event.Parent = NLS([==[ | |
| 62 | local Player = game:GetService("Players").LocalPlayer
| |
| 63 | local Event = script:WaitForChild("UserInput_Event")
| |
| 64 | ||
| 65 | local Mouse = Player:GetMouse() | |
| 66 | - | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
|
| 66 | + | |
| 67 | local input = function(io,a) | |
| 68 | if a then return end | |
| 69 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 70 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 71 | end | |
| 72 | UIS.InputBegan:Connect(input) | |
| 73 | UIS.InputEnded:Connect(input) | |
| 74 | ||
| 75 | local h,t | |
| 76 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 77 | --If player is not moving their mouse, client won't fire events | |
| 78 | while wait(1/30) do | |
| 79 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 80 | h,t=Mouse.Hit,Mouse.Target | |
| 81 | - | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS |
| 81 | + | |
| 82 | end | |
| 83 | end]==],Player.Character) | |
| 84 | - | plr = owner |
| 84 | + | |
| 85 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 86 | --Real game object | |
| 87 | local _rg = game | |
| 88 | ||
| 89 | --Metatable for fake service | |
| 90 | local fsmt = {
| |
| 91 | - | print("GET OUT OF MY ROOM I'M PLAYING MINECRAFT!")
|
| 91 | + | __index = function(self,k) |
| 92 | - | print("By Theamazingnater, now FE!")
|
| 92 | + | local s = rawget(self,"_RealService") |
| 93 | - | print("Controls: Q to mine, E to change blocks, click to place")
|
| 93 | + | if s then return s[k] end |
| 94 | end, | |
| 95 | __newindex = function(self,k,v) | |
| 96 | local s = rawget(self,"_RealService") | |
| 97 | if s then s[k]=v end | |
| 98 | end, | |
| 99 | __call = function(self,...) | |
| 100 | local s = rawget(self,"_RealService") | |
| 101 | if s then return s(...) end | |
| 102 | end | |
| 103 | } | |
| 104 | local function FakeService(t,RealService) | |
| 105 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
| 106 | return setmetatable(t,fsmt) | |
| 107 | end | |
| 108 | ||
| 109 | --Fake game object | |
| 110 | local g = {
| |
| 111 | GetService = function(self,s) | |
| 112 | return self[s] | |
| 113 | end, | |
| 114 | Players = FakeService({
| |
| 115 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
| |
| 116 | },"Players"), | |
| 117 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 118 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 119 | } | |
| 120 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
| 121 | g.service = g.GetService | |
| 122 | ||
| 123 | g.RunService = FakeService({
| |
| 124 | RenderStepped = _rg:GetService("RunService").Heartbeat,
| |
| 125 | BindToRenderStep = function(self,name,_,fun) | |
| 126 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 127 | end, | |
| 128 | UnbindFromRenderStep = function(self,name) | |
| 129 | self._btrs[name]:Disconnect() | |
| 130 | end, | |
| 131 | },"RunService") | |
| 132 | ||
| 133 | setmetatable(g,{
| |
| 134 | __index=function(self,s) | |
| 135 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
| 136 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
| 137 | end, | |
| 138 | __newindex = fsmt.__newindex, | |
| 139 | __call = fsmt.__call | |
| 140 | }) | |
| 141 | --Changing owner to fake player object to support owner:GetMouse() | |
| 142 | game,owner = g,g.Players.LocalPlayer | |
| 143 | end | |
| 144 | plr = game.Players.LocalPlayer | |
| 145 | repeat wait() until plr.Character | |
| 146 | char = plr.Character | |
| 147 | ||
| 148 | effect = Instance.new("Model",char)
| |
| 149 | effect.Name = "Effects" | |
| 150 | ||
| 151 | ||
| 152 | moozik = Instance.new("Sound",char)
| |
| 153 | moozik.SoundId = "rbxassetid://132024343" | |
| 154 | moozik.Volume = 10 | |
| 155 | moozik.Looped = true | |
| 156 | moozik:Play() | |
| 157 | hurt = Instance.new("Sound",char)
| |
| 158 | hurt.SoundId = "rbxassetid://975173739" | |
| 159 | hurt.Volume = 10 | |
| 160 | ||
| 161 | ||
| 162 | ||
| 163 | ||
| 164 | local block = Instance.new("Part",effect)
| |
| 165 | block.Size = Vector3.new(1,1,1) | |
| 166 | block.CanCollide = false | |
| 167 | local weld = Instance.new("Weld",block)
| |
| 168 | weld.Part0 = block | |
| 169 | weld.Part1 = char["Right Arm"] | |
| 170 | weld.C0 = CFrame.new(-0.00427627563, -0.0187358856, 1.48222256, 1, 0, 0, 0, -0.0125430031, -0.999921381, 0, 0.999921262, -0.0125430049) | |
| 171 | local decal1 = Instance.new("Decal",block)
| |
| 172 | decal1.Face = "Top" | |
| 173 | local decal2 = Instance.new("Decal",block)
| |
| 174 | decal2.Face = "Front" | |
| 175 | local decal3 = Instance.new("Decal",block)
| |
| 176 | decal3.Face = "Bottom" | |
| 177 | local decal4 = Instance.new("Decal",block)
| |
| 178 | decal4.Face = "Back" | |
| 179 | local decal5 = Instance.new("Decal",block)
| |
| 180 | decal5.Face = "Left" | |
| 181 | local decal6 = Instance.new("Decal",block)
| |
| 182 | decal6.Face = "Right" | |
| 183 | damaged = false | |
| 184 | local reddamage = function(timeofeffect) | |
| 185 | for i,v in pairs(char:GetChildren()) do | |
| 186 | if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then | |
| 187 | local cp = v:Clone() | |
| 188 | cp.Parent = effect | |
| 189 | cp.BrickColor = BrickColor.new("Really red")
| |
| 190 | cp.Transparency = 0.7 | |
| 191 | cp.CanCollide = false | |
| 192 | cp.Material = Enum.Material.Neon | |
| 193 | if cp.Name == "Head" then | |
| 194 | cp.face:Destroy() | |
| 195 | end | |
| 196 | if cp.Name == "Torso" then | |
| 197 | cp.roblox:Destroy() | |
| 198 | end | |
| 199 | if v ~= char.Head then | |
| 200 | cp.Size = v.Size+(Vector3.new(1,1,1)*0.2) | |
| 201 | else | |
| 202 | cp.Size = (Vector3.new(1,1,1)*v.Size.Y)+(Vector3.new(1,1,1)*0.2) | |
| 203 | end | |
| 204 | local weld = Instance.new("Weld",cp)
| |
| 205 | weld.Part0 = v | |
| 206 | weld.Part1 = cp | |
| 207 | game:GetService("Debris"):AddItem(cp,timeofeffect)
| |
| 208 | end | |
| 209 | end | |
| 210 | char.Torso.Velocity = char.Torso.CFrame.lookVector * -100 | |
| 211 | hurt:Play() | |
| 212 | end | |
| 213 | ||
| 214 | function changeyourblockdecal(bottom,top,left,right,back,front) | |
| 215 | decal3.Texture = bottom | |
| 216 | decal1.Texture = top | |
| 217 | decal5.Texture = left | |
| 218 | decal6.Texture = right | |
| 219 | decal4.Texture = back | |
| 220 | decal2.Texture = front | |
| 221 | end | |
| 222 | function changeblockdecal(whatblock , bottom,top,left,right,back,front) | |
| 223 | local tex1 = Instance.new("Decal",whatblock)
| |
| 224 | tex1.Face = "Top" | |
| 225 | local tex2 = Instance.new("Decal",whatblock)
| |
| 226 | tex2.Face = "Front" | |
| 227 | local tex3 = Instance.new("Decal",whatblock)
| |
| 228 | tex3.Face = "Bottom" | |
| 229 | local tex4 = Instance.new("Decal",whatblock)
| |
| 230 | tex4.Face = "Back" | |
| 231 | local tex5 = Instance.new("Decal",whatblock)
| |
| 232 | tex5.Face = "Left" | |
| 233 | local tex6 = Instance.new("Decal",whatblock)
| |
| 234 | tex6.Face = "Right" | |
| 235 | tex3.Texture = bottom | |
| 236 | tex1.Texture = top | |
| 237 | tex5.Texture = left | |
| 238 | tex6.Texture = right | |
| 239 | tex4.Texture = back | |
| 240 | tex2.Texture = front | |
| 241 | end | |
| 242 | lhand = char.Torso["Left Shoulder"]:Clone() | |
| 243 | - | wait() |
| 243 | + | |
| 244 | local rhandweld = Instance.new("Weld",char)
| |
| 245 | rhandweld.Part0 = char.Torso | |
| 246 | rhandweld.Part1 = char["Right Arm"] | |
| 247 | - | wait() |
| 247 | + | |
| 248 | local human2 = Instance.new("Weld",char)
| |
| 249 | human2.Part0 = char.HumanoidRootPart | |
| 250 | human2.Part1 = char.Torso | |
| 251 | human2co = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
| 252 | ||
| 253 | ||
| 254 | - | wait() |
| 254 | + | |
| 255 | if whattype == "Grass" then | |
| 256 | 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")
| |
| 257 | end | |
| 258 | - | wait() |
| 258 | + | |
| 259 | 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")
| |
| 260 | end | |
| 261 | if whattype == "Cobblestone" then | |
| 262 | 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")
| |
| 263 | end | |
| 264 | - | wait() |
| 264 | + | |
| 265 | 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")
| |
| 266 | end | |
| 267 | if whattype == "Stone" then | |
| 268 | 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")
| |
| 269 | end | |
| 270 | if whattype == "DiamondBlock" then | |
| 271 | 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")
| |
| 272 | end | |
| 273 | if whattype == "DiamondOre" then | |
| 274 | 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")
| |
| 275 | end | |
| 276 | if whattype == "WoodenPlank" then | |
| 277 | 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")
| |
| 278 | end | |
| 279 | if whattype == "OakWood" then | |
| 280 | 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")
| |
| 281 | end | |
| 282 | if whattype == "GoldOre" then | |
| 283 | 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")
| |
| 284 | end | |
| 285 | if whattype == "Sponge" then | |
| 286 | 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")
| |
| 287 | end | |
| 288 | end | |
| 289 | ||
| 290 | changeblocktype("Grass")
| |
| 291 | ||
| 292 | ||
| 293 | ||
| 294 | function playanim(whatanim,speed) | |
| 295 | if whatanim == "Place" then | |
| 296 | rhandweld.Parent = char.Torso | |
| 297 | for i = 0,1, speed do | |
| 298 | 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) | |
| 299 | game:GetService("RunService").RenderStepped:wait()
| |
| 300 | end | |
| 301 | for i = 0,1, speed do | |
| 302 | 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) | |
| 303 | game:GetService("RunService").RenderStepped:wait()
| |
| 304 | end | |
| 305 | end | |
| 306 | if whatanim == "Destroy" then | |
| 307 | rhandweld.Parent = char.Torso | |
| 308 | for i = 0,1, speed do | |
| 309 | 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) | |
| 310 | game:GetService("RunService").RenderStepped:wait()
| |
| 311 | end | |
| 312 | for i = 0,1, speed do | |
| 313 | 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) | |
| 314 | game:GetService("RunService").RenderStepped:wait()
| |
| 315 | end | |
| 316 | end | |
| 317 | if whatanim == "NormalPose" then | |
| 318 | for i = 0,1 , speed do | |
| 319 | 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) | |
| 320 | game:GetService("RunService").RenderStepped:wait()
| |
| 321 | end | |
| 322 | end | |
| 323 | end | |
| 324 | canuse = true | |
| 325 | mouse = plr:GetMouse() | |
| 326 | function buildblock() | |
| 327 | if canuse then | |
| 328 | canuse = false | |
| 329 | playanim("Place", 0.07)
| |
| 330 | local theactualblock = Instance.new("Part")
| |
| 331 | theactualblock:BreakJoints() | |
| 332 | theactualblock.Parent = workspace | |
| 333 | theactualblock.Transparency = 0 | |
| 334 | theactualblock.CFrame = mouse.Hit + Vector3.new(0,1.09,0) | |
| 335 | theactualblock.Orientation = Vector3.new(0,0,0) | |
| 336 | - | end |
| 336 | + | |
| 337 | theactualblock.Anchored = true | |
| 338 | theactualblock.CanCollide = true | |
| 339 | theactualblock.Name = "BlockPlace" | |
| 340 | changeblockdecal(theactualblock,decal3.Texture, decal1.Texture, decal5.Texture,decal6.Texture, decal4.Texture, decal2.Texture) | |
| 341 | playanim("NormalPose", 0.3)
| |
| 342 | canuse = true | |
| 343 | end | |
| 344 | end | |
| 345 | function destroyblock() | |
| 346 | if mouse.Target.Name == "BlockPlace" and mouse.Target.Name ~= "Base" and mouse.Target.Name ~= "Baseplate" and mouse.Target.Name ~= "Workspace" then | |
| 347 | playanim("Destroy", 0.07)
| |
| 348 | mouse.Target:Destroy() | |
| 349 | playanim("NormalPose", 0.3)
| |
| 350 | end | |
| 351 | end | |
| 352 | local mouse1 = mouse.Button1Down:connect(function() | |
| 353 | buildblock() | |
| 354 | end) | |
| 355 | local mouse2 = mouse.KeyDown:connect(function(k) | |
| 356 | if k == "q" then | |
| 357 | destroyblock() | |
| 358 | end | |
| 359 | if k == "e" then | |
| 360 | local chance = math.random(1,11) | |
| 361 | if chance == 1 then | |
| 362 | changeblocktype("Grass")
| |
| 363 | end | |
| 364 | if chance == 2 then | |
| 365 | changeblocktype("Dirt")
| |
| 366 | end | |
| 367 | if chance == 3 then | |
| 368 | changeblocktype("Cobblestone")
| |
| 369 | end | |
| 370 | if chance == 4 then | |
| 371 | changeblocktype("Gold")
| |
| 372 | end | |
| 373 | if chance == 5 then | |
| 374 | changeblocktype("Stone")
| |
| 375 | end | |
| 376 | if chance == 6 then | |
| 377 | changeblocktype("DiamondBlock")
| |
| 378 | end | |
| 379 | if chance == 7 then | |
| 380 | changeblocktype("DiamondOre")
| |
| 381 | end | |
| 382 | if chance == 8 then | |
| 383 | changeblocktype("WoodenPlank")
| |
| 384 | end | |
| 385 | if chance == 9 then | |
| 386 | changeblocktype("OakWood")
| |
| 387 | end | |
| 388 | if chance == 10 then | |
| 389 | changeblocktype("GoldOre")
| |
| 390 | end | |
| 391 | if chance == 11 then | |
| 392 | changeblocktype("Sponge")
| |
| 393 | end | |
| 394 | end | |
| 395 | end) | |
| 396 | HasDied = false | |
| 397 | Dead = false | |
| 398 | local reddeath = function() | |
| 399 | for i,v in pairs(char:GetChildren()) do | |
| 400 | if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then | |
| 401 | local cp = v:Clone() | |
| 402 | cp.Parent = effect | |
| 403 | cp.BrickColor = BrickColor.new("Really red")
| |
| 404 | cp.Transparency = 1 | |
| 405 | cp.CanCollide = false | |
| 406 | cp.Material = Enum.Material.Neon | |
| 407 | if cp.Name == "Head" then | |
| 408 | cp.face:Destroy() | |
| 409 | end | |
| 410 | if cp.Name == "Torso" then | |
| 411 | cp.roblox:Destroy() | |
| 412 | end | |
| 413 | if v ~= char.Head then | |
| 414 | cp.Size = v.Size+(Vector3.new(1,1,1)*0.2) | |
| 415 | else | |
| 416 | cp.Size = (Vector3.new(1,1,1)*v.Size.Y)+(Vector3.new(1,1,1)*0.2) | |
| 417 | end | |
| 418 | local weld = Instance.new("Weld",cp)
| |
| 419 | weld.Part0 = v | |
| 420 | weld.Part1 = cp | |
| 421 | end | |
| 422 | end | |
| 423 | end | |
| 424 | reddeath() | |
| 425 | generategui = function() | |
| 426 | local screen = Instance.new("ScreenGui",plr.PlayerGui)
| |
| 427 | screen.Name = "Death(lol i was lazy to add buttons lol)" | |
| 428 | local text = Instance.new("TextLabel",screen)
| |
| 429 | text.Text = "You died!" | |
| 430 | text.TextColor3 = Color3.new(1,1,1) | |
| 431 | text.Font = "Arcade" | |
| 432 | - | wait() |
| 432 | + | |
| 433 | text.Position = UDim2.new(0.381, 0,0.172, 0) | |
| 434 | text.Size = UDim2.new(0, 200, 0, 50) | |
| 435 | text.BackgroundTransparency = 1 | |
| 436 | local respawn = Instance.new("TextButton",screen)
| |
| 437 | respawn.Text = "Respawn" | |
| 438 | respawn.TextScaled = true | |
| 439 | respawn.Position = UDim2.new(0.381, 0,0.561, 0) | |
| 440 | respawn.Size = UDim2.new(0, 200,0, 50) | |
| 441 | respawn.BackgroundTransparency = 1 | |
| 442 | respawn.TextColor3 = Color3.new(1,1,1) | |
| 443 | respawn.Font = "Arcade" | |
| 444 | respawn.MouseButton1Click:connect(function() | |
| 445 | Dead = false | |
| 446 | HasDied = false | |
| 447 | char.Humanoid.Health = 0 | |
| 448 | char.Parent = nil | |
| 449 | respawn.Text = "Say g/r or g/sr to respawn properly" | |
| 450 | end) | |
| 451 | end | |
| 452 | local BODY = {}
| |
| 453 | LeftArm = char["Left Arm"] | |
| 454 | RightLeg = char["Right Leg"] | |
| 455 | LeftLeg = char["Left Leg"] | |
| 456 | for _, c in pairs(char:GetDescendants()) do | |
| 457 | if c:IsA("BasePart") and c.Name ~= "Handle" then
| |
| 458 | 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 | |
| 459 | c.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0) | |
| 460 | end | |
| 461 | table.insert(BODY,{c,c.Parent,c.Material,c.Color,c.Transparency})
| |
| 462 | elseif c:IsA("JointInstance") then
| |
| 463 | table.insert(BODY,{c,c.Parent,nil,nil,nil})
| |
| 464 | end | |
| 465 | end | |
| 466 | for e = 1, #BODY do | |
| 467 | if BODY[e] ~= nil then | |
| 468 | local STUFF = BODY[e] | |
| 469 | local PART = STUFF[1] | |
| 470 | local PARENT = STUFF[2] | |
| 471 | local MATERIAL = STUFF[3] | |
| 472 | local TRANSPARENCY = STUFF[5] | |
| 473 | if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then | |
| 474 | PART.Material = MATERIAL | |
| 475 | PART.Transparency = TRANSPARENCY | |
| 476 | end | |
| 477 | PART.AncestryChanged:Connect(function() | |
| 478 | PART.Parent = PARENT | |
| 479 | end) | |
| 480 | end | |
| 481 | end | |
| 482 | function refit() | |
| 483 | char.Parent = workspace | |
| 484 | for e = 1, #BODY do | |
| 485 | if BODY[e] ~= nil then | |
| 486 | local STUFF = BODY[e] | |
| 487 | local PART = STUFF[1] | |
| 488 | local PARENT = STUFF[2] | |
| 489 | local MATERIAL = STUFF[3] | |
| 490 | local TRANSPARENCY = STUFF[5] | |
| 491 | if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then | |
| 492 | PART.Material = MATERIAL | |
| 493 | PART.Transparency = TRANSPARENCY | |
| 494 | end | |
| 495 | if PART.Parent ~= PARENT then | |
| 496 | char:FindFirstChildOfClass("Humanoid"):remove()
| |
| 497 | PART.Parent = PARENT | |
| 498 | Humanoid = Instance.new("Humanoid",char)
| |
| 499 | end | |
| 500 | end | |
| 501 | end | |
| 502 | end | |
| 503 | char.Humanoid.Died:connect(function() | |
| 504 | hurt:Play() | |
| 505 | refit() | |
| 506 | mouse1:Disconnect() | |
| 507 | mouse2:Disconnect() | |
| 508 | for i,v in pairs(effect:GetChildren()) do | |
| 509 | if v.ClassName == "Part" then | |
| 510 | v.Transparency = 0.7 | |
| 511 | end | |
| 512 | end | |
| 513 | workspace.CurrentCamera.CameraSubject = char.Head | |
| 514 | generategui() | |
| 515 | HasDied = true | |
| 516 | Dead = true | |
| 517 | for i = 0,1, 0.03 do | |
| 518 | 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) | |
| 519 | game:GetService("RunService").RenderStepped:wait()
| |
| 520 | end | |
| 521 | end) | |
| 522 | while true do | |
| 523 | game:GetService("RunService").RenderStepped:wait()
| |
| 524 | if char.Humanoid.Health < 100 and not damaged and not Dead and not HasDied then | |
| 525 | reddamage(0.5) | |
| 526 | damaged = true | |
| 527 | wait(1) | |
| 528 | damaged = false | |
| 529 | char.Humanoid.Health = 100 | |
| 530 | end | |
| 531 | if char.Humanoid.Health < 1 and Dead and HasDied then | |
| 532 | refit() | |
| 533 | for i,v in pairs(effect:GetChildren()) do | |
| 534 | if v.ClassName == "Part" then | |
| 535 | v.Transparency = 0.7 | |
| 536 | end | |
| 537 | end | |
| 538 | end | |
| 539 | if Dead and HasDied then | |
| 540 | char.Humanoid.WalkSpeed = 0 | |
| 541 | char.Humanoid.JumpPower = 0 | |
| 542 | human2.Parent = char.Torso | |
| 543 | rhandweld.Parent = char.Torso | |
| 544 | end | |
| 545 | end |