function touched(hit) wait(.1) if hit.Parent~=nil then local h=hit.Parent:FindFirstChild("Humanoid") if h~=nil then if h.Health>0 then local s=hit.Parent:FindFirstChild("Shirt") local p=hit.Parent:FindFirstChild("Pants") local t=hit.Parent.Torso:FindFirstChild("roblox") if s~=nil then s:remove() end if p~=nil then p:remove() end h.MaxHealth=200 if t~=nil then if t.Texture=="http://www.roblox.com/asset/?id=3555194" then h.MaxHealth=500 <--------------------------i could cheat right here, but i like a fair game. :) else t:remove() end end h.Health=h.MaxHealth h.Health=h.Health-1 h.Parent.Head.BrickColor=BrickColor.new("Black") h.Parent:FindFirstChild("Torso").BrickColor=BrickColor.new("Light stone grey") h.Parent:FindFirstChild("Left Arm").BrickColor=BrickColor.new("Light stone grey") h.Parent:FindFirstChild("Left Leg").BrickColor=BrickColor.new("Light stone grey") h.Parent:FindFirstChild("Right Arm").BrickColor=BrickColor.new("Light stone grey") h.Parent:FindFirstChild("Right Leg").BrickColor=BrickColor.new("Light stone grey") end end wait(.5) end end script.Parent.Touched:connect(touched)
--http://www.roblox.com/asset/?id=3555194
✓ ANSWER ACCEPTED
Script doesn't work when i touch the button on touch?
1 answer
✓ Accepted answer
It should work, it's probably because half of your code is green (meaning it is included in the "--", usually it is used to put notes in the script and will not be run by the script).
function touched(hit)
task.wait(0.1)
if hit.Parent ~= nil then
local h = hit.Parent:FindFirstChildWhichIsA("Humanoid")
if h ~= nil then
if h.Health > 0 then
local s = hit.Parent:FindFirstChild("Shirt")
local p = hit.Parent:FindFirstChild("Pants")
local t = hit.Parent.Torso:FindFirstChild("roblox")
if s ~= nil then
s:remove()
end
if p ~= nil then
p:remove()
end
h.MaxHealth = 200
if t ~= nil then
if t.Texture == "http://www.roblox.com/asset/?id=3555194" then
h.MaxHealth=500 --i could cheat right here, but i like a fair game. :)
else
t:remove()
end
end
h.Health = h.MaxHealth
h.Health -= 1
for _, limb in h.Parent:GetChildren() do
if limb:IsA("BasePart") then
if limb.Name == "Head" then
limb.BrickColor = BrickColor.new("Black")
else
limb.BrickColor = BrickColor.new("Light stone grey")
end
end
end
end
end
task.wait(0.5)
end
end
script.Parent.Touched:Connect(touched)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Place your code inside a code block, so it is easier to read..
Looks like you made the code block... Seems like you forgot to put the code in it. Put the code in-between the top and bottom lines when selecting the code block.
I put it in a code block for you, but you have everything on one line...