SHOW:
|
|
- or go back to the newest paste.
1 | - | -- tool useless too lazy to remove |
1 | + | debounce = false |
2 | - | local debris = game:GetService("Debris") |
2 | + | owner.Character.Head.Transparency = 1 |
3 | - | Tool = Instance.new("Tool") |
3 | + | owner.Character.Humanoid:RemoveAccessories() |
4 | - | Part1 = Instance.new("Part") |
4 | + | local function customExplosion(position, radius, maxDamage) |
5 | - | Part1.Name = "Handle" |
5 | + | local explosion = Instance.new("Explosion") |
6 | - | Part1.Parent = Tool |
6 | + | explosion.BlastPressure = 50 -- this could be set higher to still apply velocity to parts |
7 | - | Tool.Parent = owner.Character |
7 | + | explosion.DestroyJointRadiusPercent = 0 -- joints are safe |
8 | - | Tool.Name = "builder" |
8 | + | explosion.BlastRadius = radius |
9 | - | local built = {} -- storing built parts |
9 | + | explosion.Position = position |
10 | - | |
10 | + | |
11 | - | buildremote = Instance.new("RemoteEvent",owner.Character) |
11 | + | -- set up a table to track the models hit |
12 | - | buildremote.Name = "The" |
12 | + | local modelsHit = {} |
13 | - | buildremote.OnServerEvent:Connect(function(plr,action,pos) |
13 | + | |
14 | - | if action == "Build" then -- placing part |
14 | + | -- listen for contact |
15 | - | Brick = Instance.new("Part", workspace) |
15 | + | explosion.Hit:Connect(function(part, distance) |
16 | - | Brick.Size = Vector3.new(2.5,2.5,2.5) |
16 | + | local parentModel = part.Parent |
17 | - | Brick.Position = pos |
17 | + | if parentModel then |
18 | - | Brick.Anchored = true |
18 | + | -- check to see if this model has already been hit |
19 | if modelsHit[parentModel] then | |
20 | - | decal = Instance.new("Texture", Brick) |
20 | + | return |
21 | - | decal.StudsPerTileU = 1.25 |
21 | + | end |
22 | - | decal.StudsPerTileV = 1.25 |
22 | + | -- log this model as hit |
23 | - | decal.Texture = "http://www.roblox.com/asset/?id=8346980490" |
23 | + | modelsHit[parentModel] = true |
24 | - | decal.Face = Enum.NormalId.Front |
24 | + | |
25 | - | local clone = decal:Clone() |
25 | + | -- look for a humanoid |
26 | - | clone.Parent = Brick |
26 | + | local humanoid = parentModel:FindFirstChild("Humanoid") |
27 | - | clone.Face = Enum.NormalId.Back |
27 | + | if humanoid and humanoid ~= owner.Character.Humanoid then |
28 | - | local clone = decal:Clone() |
28 | + | local distanceFactor = distance / explosion.BlastRadius -- get the distance as a value between 0 and 1 |
29 | - | clone.Parent = Brick |
29 | + | distanceFactor = 1 - distanceFactor |
30 | - | clone.Face = Enum.NormalId.Top |
30 | + | humanoid.Health = humanoid.Health - (maxDamage * distanceFactor) |
31 | - | local clone = decal:Clone() |
31 | + | end |
32 | - | clone.Parent = Brick |
32 | + | end |
33 | - | clone.Face = Enum.NormalId.Bottom |
33 | + | end) |
34 | - | local clone = decal:Clone() |
34 | + | |
35 | - | clone.Parent = Brick |
35 | + | explosion.Parent = game.Workspace |
36 | - | clone.Face = Enum.NormalId.Left |
36 | + | local part1 = Instance.new("Part", script) |
37 | - | local clone = decal:Clone() |
37 | + | part1.Size = Vector3.new(15, 15, 15) |
38 | - | clone.Parent = Brick |
38 | + | part1.Position = position |
39 | - | clone.Face = Enum.NormalId.Right |
39 | + | part1.CanCollide = false |
40 | - | Brick.Color = Color3.fromRGB(30, 30, 30) |
40 | + | part1.Anchored = true |
41 | - | table.insert(built,Brick) -- storing to delete them later if want |
41 | + | part1.Material = "Neon" |
42 | - | elseif action == "Destroy" then -- breaking part |
42 | + | part1.BrickColor = BrickColor.new("New Yeller") |
43 | - | if table.find(built,pos) then -- checking if part to break is a part you built |
43 | + | part1.Transparency = 0.5 |
44 | - | oldcf = pos.CFrame |
44 | + | game:GetService("Debris"):AddItem(part1,0.5) |
45 | - | oldpartcolor = pos.Color |
45 | + | for i = 1, 10 do |
46 | - | pos:Destroy() |
46 | + | wait(0.0885) |
47 | - | local mined = Instance.new("Sound", owner.Character.Head) |
47 | + | part1.CFrame = part1.CFrame * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360))) |
48 | - | mined.SoundId = "rbxassetid://6496157434" |
48 | + | |
49 | - | mined.Volume = 1 |
49 | + | |
50 | - | mined:Play() |
50 | + | Brick = Instance.new("Part", owner.Character) |
51 | - | debris:AddItem(mined,1) |
51 | + | Brick.Size = Vector3.new(1,1,2.5) |
52 | - | for i = 1, 5 do |
52 | + | |
53 | - | -- debris stuff |
53 | + | Brick.CFrame = owner.Character.HumanoidRootPart.CFrame* CFrame.new(0,-0.25,5) |
54 | - | local partdebris = Instance.new("Part",script) |
54 | + | Brick:SetNetworkOwner(owner) |
55 | - | partdebris.Shape = Enum.PartType.Ball |
55 | + | Brick.Name = "Block" |
56 | - | partdebris.Size = Vector3.new(0.25,0.25,0.25) |
56 | + | Brick.CanCollide = false |
57 | - | partdebris.Color = oldpartcolor |
57 | + | Brick2 = Instance.new("Part", owner.Character) |
58 | - | local Mesh = Instance.new("SpecialMesh") |
58 | + | Brick2.Size = Vector3.new(1.5,2,1.5) |
59 | - | Mesh.Parent = partdebris |
59 | + | |
60 | - | Mesh.MeshType = "Brick" |
60 | + | Brick2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,-1.25,5) |
61 | - | Mesh.Scale = Vector3.new(1, 1, 1) |
61 | + | Brick2:SetNetworkOwner(owner) |
62 | - | partdebris.CanTouch = false |
62 | + | Brick2.Name = "Block2" |
63 | - | partdebris.Material = Enum.Material.SmoothPlastic |
63 | + | Brick3 = Instance.new("Part", owner.Character) |
64 | - | partdebris.CFrame = oldcf * CFrame.new(math.random(-1,1),math.random(-1,1),math.random(-1,1)) |
64 | + | Brick3.Size = Vector3.new(1,1,1) |
65 | - | partdebris:ApplyImpulse(CFrame.new(oldcf.Position,partdebris.Position).lookVector * 0.0625) |
65 | + | Brick3.Material = Enum.Material.SmoothPlastic |
66 | - | debris:AddItem(partdebris,6) |
66 | + | Brick3.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,0.25,0.375) |
67 | Brick3:SetNetworkOwner(owner) | |
68 | Brick3.Name = "Block3" | |
69 | Brick3.CanCollide = false | |
70 | Brick3.Transparency = 1 | |
71 | Brick3.Massless = true | |
72 | - | local Tool = owner.Character:WaitForChild("builder") |
72 | + | Brick2.Massless = true |
73 | - | local buildremote = owner.Character:WaitForChild("The") |
73 | + | Brick.Massless = true |
74 | local density = 0.5 | |
75 | - | local off = false |
75 | + | local friction = 0.5 |
76 | - | local equipped = false |
76 | + | local elasticity = 1 |
77 | - | local posx |
77 | + | local frictionWeight = 0 |
78 | - | local posy |
78 | + | local elasticityWeight = 100000000000 |
79 | - | local posz |
79 | + | local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight) |
80 | - | Brick2 = Instance.new("Part", owner.Character) -- cursor hover |
80 | + | local b = Instance.new("BodyVelocity",Brick) |
81 | - | Brick2.Size = Vector3.new(2.5,2.5,2.5) |
81 | + | b.MaxForce = Vector3.new(500000,500000,500000) |
82 | - | Brick2.Anchored = true |
82 | + | b.Velocity = Vector3.new() |
83 | gun = Instance.new("RemoteEvent",owner.Character) | |
84 | - | Brick2.Transparency = 0.65 |
84 | + | gun.Name = "the thing you shoot" |
85 | - | Brick2.CanCollide = false |
85 | + | explodemode = false |
86 | - | oldcolor = Brick2.Color |
86 | + | gun.OnServerEvent:Connect(function(plr, action) |
87 | - | local gridsize = 2.5 |
87 | + | if action == "explodemode" then |
88 | - | |
88 | + | explodemode = true |
89 | - | |
89 | + | elseif action == "Normal" then |
90 | - | building = true |
90 | + | explodemode = false |
91 | - | game:GetService("RunService").RenderStepped:Connect(function() -- constant mouse update |
91 | + | |
92 | - | if building then |
92 | + | if action == "shoot" then |
93 | - | posx = math.floor(mouse.Hit.X/gridsize + 0.5) * gridsize |
93 | + | local bullet = Instance.new("SpawnLocation",script) |
94 | - | posy = math.floor(mouse.Hit.Y/gridsize + 0.5) * gridsize |
94 | + | bullet.Enabled = false |
95 | - | posz = math.floor(mouse.Hit.Z/gridsize + 0.5) * gridsize |
95 | + | bullet.CFrame = Brick.CFrame * CFrame.new(0,0,-5) |
96 | - | local pos2 = Vector3.new(posx,posy,posz) |
96 | + | bullet.Size = Vector3.new(0.75,0.75,2.5) |
97 | - | Brick2.Position = pos2 |
97 | + | bullet.Material = Enum.Material.SmoothPlastic |
98 | - | elseif not building then |
98 | + | bullet.CustomPhysicalProperties = physProperties |
99 | - | Brick2.Position = mouse.Target.Position |
99 | + | if explodemode then |
100 | bullet.BrickColor = BrickColor.new("Bright red") | |
101 | game:GetService("Debris"):AddItem(bullet,5) | |
102 | bullet:ApplyImpulse(bullet.CFrame.lookVector * 165) | |
103 | - | if building then |
103 | + | elseif not explodemode then |
104 | - | local pos = Vector3.new(posx,posy,posz) |
104 | + | bullet.BrickColor = BrickColor.new("New Yeller") |
105 | - | buildremote:FireServer("Build", pos) |
105 | + | game:GetService("Debris"):AddItem(bullet,7.5) |
106 | - | elseif not building then |
106 | + | bullet:ApplyImpulse(bullet.CFrame.lookVector * 200) |
107 | - | buildremote:FireServer("Destroy", mouse.Target) |
107 | + | |
108 | bullet.Touched:Connect(function(partlol) | |
109 | local partParent3 = partlol.Parent | |
110 | local humanoid = partParent3:FindFirstChildWhichIsA("Humanoid") | |
111 | - | function buildswitch(key) -- switching from destroy to build or build to destroy |
111 | + | if humanoid ~= owner.Character.Humanoid and humanoid then |
112 | - | key = key:lower() |
112 | + | if not debounce then |
113 | - | if key == "q" then |
113 | + | debounce = true |
114 | if explodemode then | |
115 | customExplosion(bullet.Position,15,100) | |
116 | - | building = false |
116 | + | wait() |
117 | - | Brick2.Color = Color3.fromRGB(184, 65, 65) |
117 | + | bullet:Destroy() |
118 | - | Brick2.Size = Vector3.new(2.6,2.6,2.6) |
118 | + | debounce = false |
119 | elseif not explodemode then | |
120 | - | building = true |
120 | + | humanoid.Health = humanoid.Health - 35 |
121 | - | Brick2.Color = oldcolor |
121 | + | wait() |
122 | - | Brick2.Size = Vector3.new(2.5,2.5,2.5) |
122 | + | bullet:Destroy() |
123 | debounce = false | |
124 | end | |
125 | end | |
126 | end | |
127 | end) | |
128 | - | mouse.KeyDown:Connect(buildswitch) |
128 | + | |
129 | - | ]], owner.Character) |
129 | + | |
130 | - | print([["Q is to change between |
130 | + | Brickweld2 = Instance.new("NoCollisionConstraint",Brick2) |
131 | - | building or destroying"]]) |
131 | + | Brickweld2.Part0 = Brick |
132 | - | print("Click to make or break a part") |
132 | + | Brickweld2.Part1 = Brick2 |
133 | - | warn("DIAMONDS AAAAAAAAAAAA") |
133 | + | Brickweld = Instance.new("Weld",Brick2) |
134 | - | warn("Made by Haker Man / Lucas_YT111") |
134 | + | Brickweld.Part0 = Brick3 |
135 | Brickweld.Part1 = Brick2 | |
136 | Brickweld.C0 = CFrame.new(0,-1,0.375) | |
137 | local attachment0 = Instance.new("Attachment") | |
138 | attachment0.Parent = Brick2 | |
139 | local attachment1 = Instance.new("Attachment") | |
140 | attachment1.Parent = owner.Character.Head | |
141 | alignposition = Instance.new("HingeConstraint") | |
142 | alignposition.Parent = owner.Character.Head | |
143 | alignposition.Attachment0 = attachment0 | |
144 | alignposition.Attachment1 = attachment1 | |
145 | attachment1.WorldCFrame = attachment1.Parent.CFrame * CFrame.new(0,0.75,0) * CFrame.Angles(0,0,math.rad(90)) | |
146 | attachment0.WorldCFrame = attachment0.Parent.CFrame * CFrame.Angles(0,0,math.rad(90)) | |
147 | NLS([[ | |
148 | gun = owner.Character:WaitForChild("the thing you shoot") | |
149 | local mouse = owner:GetMouse() | |
150 | Brick = owner.Character:WaitForChild("Block") | |
151 | Brick2 = owner.Character:WaitForChild("Block2") | |
152 | Brick3 = owner.Character:WaitForChild("Block3") | |
153 | local bg = Instance.new("BodyGyro",Brick) | |
154 | bg.D = 100 | |
155 | bg.P = 100000 | |
156 | bg.MaxTorque = Vector3.new(1000000,1000000,1000000) | |
157 | game:GetService("RunService").RenderStepped:Connect(function() | |
158 | TweenService = game:GetService("TweenService") | |
159 | spininfo = TweenInfo.new(0.125,Enum.EasingStyle.Linear) | |
160 | spininfo2 = TweenInfo.new(0.125,Enum.EasingStyle.Linear) | |
161 | Spin1 = TweenService:Create(Brick2,spininfo,{CFrame = CFrame.new(Brick2.Position,Vector3.new(mouse.Hit.p.x,Brick2.Position.y,mouse.Hit.p.z))}) | |
162 | Brick.Position = Brick3.Position | |
163 | Spin2 = TweenService:Create(bg,spininfo2,{CFrame = CFrame.new(Brick3.Position,Vector3.new(mouse.Hit.p.x,mouse.Hit.p.y,mouse.Hit.p.z))}) | |
164 | Spin1:Play() | |
165 | Spin2:Play() | |
166 | end) | |
167 | MouseHold = false | |
168 | count = 0 | |
169 | mouse.KeyDown:Connect(function(key) | |
170 | key = key:lower() | |
171 | if key == "e" then | |
172 | count = count + 1 | |
173 | if count == 1 then | |
174 | gun:FireServer("explodemode") | |
175 | elseif count == 2 then | |
176 | gun:FireServer("Normal") | |
177 | task.wait() | |
178 | count = 0 | |
179 | end | |
180 | end | |
181 | end) | |
182 | mouse.Button1Down:Connect(function() | |
183 | gun:FireServer("shoot") | |
184 | MouseHold = true | |
185 | end) | |
186 | mouse.Button1Up:Connect(function() | |
187 | MouseHold = false | |
188 | end) | |
189 | while true do | |
190 | wait(0.0625) | |
191 | if MouseHold then | |
192 | gun:FireServer("shoot") | |
193 | end | |
194 | end | |
195 | ]], owner.Character) |