I have tried making something but it doesn't seem to be working, here is my script in the lazer:
01 | function onTouch(part) |
02 | if script.Parent.Transparency = = 0 then |
03 | local humanoid = part.Parent:FindFirstChild( "Humanoid" ) |
04 | if (humanoid ~ = nil ) then |
05 | humanoid.Health = 0 |
06 | end |
07 | end |
08 | end |
09 |
10 | while true do |
11 | script.Parent.Transparency = script.Parent.Transparency + 0.5 |
12 | wait( 0.5 ) |
13 | script.Parent.Transparency = script.Parent.Transparency + 0.5 |
14 | wait( 1 ) |
15 | script.Parent.Transparency = 0 |
16 | wait( 1.5 ) |
17 | end |
18 |
19 | script.Parent.Touched:Connect(onTouch) |
sorry this is a late reply but
1 | function onTouch(hit) |
2 | local h = hit.Parent:FindFirstChild( "Humanoid" ) |
3 | if h ~ = nil then |
4 | h.Health = 0 |
5 | end |
6 | end |
7 |
8 | script.Parent.Touched:Connect(onTouch) |
not sure how to do the when its invisible not kill but i would suggest to add and if then elseif to your script saying if its transparency == 0 then h.Health = 0 else if transparency == 1 then h.Health = 10 or something along those lines have a look at dev forum, google ect to find out how
would this work? function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then -- if a humanoid exists, then humanoid.Health = 0 -- damage the humanoid end end function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") script.Parent.Touched:connect(onTouch) if script.Parent.Transparency == 1 then if (humanoid ~= nil) then humanoid.Health = 0 end end end