generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Why isn't this working?

Previous Thread :: Next Thread 
rudolph101 is not online. rudolph101
Joined: 15 Jan 2009
Total Posts: 11873
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
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
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
rudolph101 is not online. rudolph101
Joined: 15 Jan 2009
Total Posts: 11873
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
rudolph101 is not online. rudolph101
Joined: 15 Jan 2009
Total Posts: 11873
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image