Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Can i have some help with this script please?

Asked by 10 years ago

After Ive already been blown up and respawned I keep blowing up like 3 times! Its basically a countdown until the explosion in the Base plate is deactivated. Can you help me fix this issue? Here is the script

Game.Workspace.Button.Touched:connect(function(hit) if hit then 
    Game.Workspace.Button:Remove()

wait(5)
game.Workspace.Base.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
e = Instance.new("Explosion",game.Workspace)
e.Position = hit.Parent.Torso.Position
end end)
s = Instance.new("Sound")
s.Parent = script.Parent
s.SoundId = "http://www.roblox.com/asset/?id=141252315"
s.Name = ("Tick")
local textColor = Color3.new(225,225,225)
local bbGui = Instance.new("BillboardGui", Game.Workspace.Base)
bbGui.Adornee = Game.Workspace.Base
bbGui.Size = UDim2.new(2, 0, 2, 0)
bbGui.StudsOffset = Vector3.new(0 ,10, 0) 
bbGui.AlwaysOnTop = true
local textLabel = Instance.new("TextLabel", bbGui)
textLabel.Size = UDim2.new(10, 0, 10,0)
textLabel.BackgroundTransparency = 1
textLabel.Font = "ArialBold"
textLabel.TextScaled = true
textLabel.TextColor3 = textColor
textLabel.FontSize = "Size48"
textLabel.TextStrokeTransparency = 0
for i = 10,1,-1 do
textLabel.Text = (i) s:Play() wait(1) end bbGui:Remove() script.Parent:Remove()e:Destroy() end end)


Copyright by shadowsonichedgehogx

0
Code block please. Tempestatem 884 — 10y
0
there shadowsonichedgehogx -2 — 10y
0
You should debounce it. Otherwise it happensmultiple times. Tempestatem 884 — 10y
0
can you debounce it for me plz? shadowsonichedgehogx -2 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
debounce=false
Game.Workspace.Button.Touched:connect(function(hit) if hit then 
    Game.Workspace.Button:Remove()

wait(5)
game.Workspace.Base.Touched:connect(function(hit)
if debounce==true then
elseif debounce== false then
debounce=true
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
e = Instance.new("Explosion",game.Workspace)
e.Position = hit.Parent.Torso.Position
end end)
s = Instance.new("Sound")
s.Parent = script.Parent
s.SoundId = "http://www.roblox.com/asset/?id=141252315"
s.Name = ("Tick")
local textColor = Color3.new(225,225,225)
local bbGui = Instance.new("BillboardGui", Game.Workspace.Base)
bbGui.Adornee = Game.Workspace.Base
bbGui.Size = UDim2.new(2, 0, 2, 0)
bbGui.StudsOffset = Vector3.new(0 ,10, 0) 
bbGui.AlwaysOnTop = true
local textLabel = Instance.new("TextLabel", bbGui)
textLabel.Size = UDim2.new(10, 0, 10,0)
textLabel.BackgroundTransparency = 1
textLabel.Font = "ArialBold"
textLabel.TextScaled = true
textLabel.TextColor3 = textColor
textLabel.FontSize = "Size48"
textLabel.TextStrokeTransparency = 0
for i = 10,1,-1 do
textLabel.Text = (i) s:Play() wait(1) end bbGui:Remove() script.Parent:Remove()e:Destroy() end 
wait(5)
debounce=false
end)



If you want it to happen just one time, remove the "Wait 5" and "Debounce=false" at the bottom

Ad

Answer this question