|
| 01 Nov 2012 05:50 AM |
I made a script which is meant to make a brick seem like it's disappearing, and it worked fine before I put the if statement in. I've asked it to check if that brick's transparency is 0.4, which it is before doing it. I've set it to print "No Melt" if it isn't that. It's only printing "No Melt". Why is this happening?
ice=script.Parent
function melt() if ice.Transparency==0.4 then for i=0.4, 1, 0.1 do ice.Transparency=(i) wait(0.5) end ice.CanCollide=false wait(4) for i=1, 0.4, -0.1 do ice.Transparency=i wait(0.5) end ice.CanCollide=true else print("No Melt") end end
script.Parent.Touched:connect(melt) |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 06:25 AM |
ice = script.Parent
ice.Touched:connect(function(h) if not h and not h.Parent then return end if h.Parent:findFirstChild("Humanoid") then if not ice.Transparency == 0.4 then return end for i=0.4, 1, 0.1 do ice.Transparency = i wait(.5) end ice.CanCollide = false wait(4) for i=1,0.4,0.1 do ice.Transparency = i wait(.5) end end end)
should work :P |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 06:29 AM |
Okay thank you!:D
"ice.Touched:connect(function(h)"
I've never learned what this means. What can I search to find it on the wiki? |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2012 06:32 AM |
Oh wait a second, when I touch the ice when it's not 0.4 transparency, it still changed back to 0.4 and gets all messed up?
I'm not too good at scripting, so I'm having trouble figuring it out. I also changed the script a little bit because it wasn't working properly. I had to add the cancollide part in and add the - sign on the second for statement.
ice=script.Parent
ice.Touched:connect(function(h) if not h and not h.Parent then return end if h.Parent:findFirstChild("Humanoid") then if not ice.Transparency == 0.4 then return end for i=0.4, 1, 0.1 do ice.Transparency = i wait(.5) end ice.CanCollide = false wait(4) for i=1,0.4,-0.1 do ice.Transparency = i wait(.5) end ice.CanCollide=true end end) |
|
|
| Report Abuse |
|
|