Instance.new("Part",workspace)
local nuke = game.Workspace.Part
position = nuke.CFrame
while wait(0.1) do
nuke.Size = nuke.Size + Vector3.new(0.5,0.5,0.5)
nuke.CFrame = position
end
function onTouch(Brick)
local Player = Brick.Parent:FindFirstChild("Humanoid")
if(Player ~= nil)then
Player.Health = Player.Health - 100
end
end
nuke.Touched:connect(onTouch)
✓ ANSWER ACCEPTED
Nuke script that grows and kills people who touches?
1 answer
✓ Accepted answer
You are running an infinite loop before connecting the touched event, so the event never gets connected to the part.
Solution:
local nuke = Instance.new("Part", game.Workspace)
nuke.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0
end
end)
while wait() do
nuke.Size = nuke.Size + Vector3.new(0.5, 0.5, 0.5)
nuke.CFrame = CFrame.new()
end
1 comment
0
Thanks man.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Do not only post code into your question, add an explanation to it. What is the problem?
Ok my bad, first time with this site and scripting and all. I'm trying to make a "nuke" (really a part that grows and if you touch it you die) The part grows and all but I can't figure out why it wont kill me when I touch it.