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: Newbie Scripter...

Previous Thread :: Next Thread 
Necrorave is not online. Necrorave
Joined: 07 Dec 2008
Total Posts: 108
02 Jan 2012 11:12 AM
I am attmepting to make a block slowly vanish until it becomes compeletly transparent and 'CanCollide = false' when you touch it.

Can someone point me in why this is not working? (It does not change Transparency until the very end when it dissappears) If the entire thing is wrong please do not write me a new one. I prefer learning how to do it myself Thank you :)

function Vanish(part)

Player = part.Parent:findFirstChild("Humanoid")
Rock = game.Workspace.VanishingRocks:findFirstChild("Rock2")

if Player ~= nil then
wait(1)
Rock.Transparency = 0.2
wait(1)
Rock.Transparency = 0.5
wait(1)
Rock.Transparency = 0.8
wait(1)
Rock.Transparency = 1.0
Rock.CanCollide = false
wait(3)
Rock.Transparency = 0
Rock.CanCollide = true

end

end

script.Parent.Touched:connect(Vanish)
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
02 Jan 2012 11:15 AM
Well, first, I would suggest an anonymous function to replace your current one.

Second, use a numeric for loop to change the transparency.

Good luck!


(P.S - I almost completely re-wrote it for you, but I saw your note just in time :P)
Report Abuse
Necrorave is not online. Necrorave
Joined: 07 Dec 2008
Total Posts: 108
02 Jan 2012 11:16 AM
By anonymous you mean anything but?

And I shall mess around with loops then, see if I can make it dance :D

Thanks alot.
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
02 Jan 2012 11:18 AM
Here's an example of an anonymous function:

game.Workspace.Brick1.Touched:connect(function(hit)
end)

Basically, it defines everything in the beginning, and there's no need for a listening line.

If you need more explanation on it, look it up in the wiki!
Report Abuse
Necrorave is not online. Necrorave
Joined: 07 Dec 2008
Total Posts: 108
02 Jan 2012 11:44 AM
I put it into a for loop which I believe would work. Although I am a bit unsure how to make the anonymous function even after looking it up.

I didn't want to ask this of anybody but if I were to make my function anonymous how would it look? Would it work?

function Vanish(part)

Player = part.Parent:findFirstChild("Humanoid")
Rock = game.Workspace.VanishingRocks:findFirstChild("Rock2")

for x = 0, 5, 1 do
wait(1)
Rock.Transparency = Rock.Transparency + 0.2

if x = 5 then
Rock.CanCollide = false
wait(3)
Rock.CanCollide = true
Rock.Transparency = 0
end

end

end

script.Parent.Touched:connect(Vanish)

Report Abuse
Swordphin123 is not online. Swordphin123
Joined: 09 Apr 2008
Total Posts: 5234
02 Jan 2012 11:45 AM
It would look like this, and this is the whole script. No need to add anymore:

~~~~

script.Parent.Touched:connect(function(part)

Player = part.Parent:findFirstChild("Humanoid")
Rock = game.Workspace.VanishingRocks:findFirstChild("Rock2")

for x = 0, 5, 1 do
wait(1)
Rock.Transparency = Rock.Transparency + 0.2

if x = 5 then
Rock.CanCollide = false
wait(3)
Rock.CanCollide = true
Rock.Transparency = 0
end

end

end)
Report Abuse
Necrorave is not online. Necrorave
Joined: 07 Dec 2008
Total Posts: 108
02 Jan 2012 11:48 AM
I see, thank you very much sir. Sorry for asking someone to do it for me. I really hate to but sometimes I need to be hit with the palm of obviousness.

Thanks alot for your time guys.
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
02 Jan 2012 11:49 AM
Rock = game.Workspace.VanishingRocks:findFirstChild("Rock2")
Player = part.Parent:findFirstChild("Humanoid")

Rock.Touched:connect(function(hit)
if hit.Parent then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid ~= nil then
for i = 0, 1, 0.1 do
wait(1)
Rock.Transparency = i
wait(1)
Rock.CanCollide = false
wait(3)
Rock.CanCollide = true
Rock.Transparency = 0
end
end
end
end
end) -- Hope this script works!
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
02 Jan 2012 11:51 AM
Oops, remove the Player variable, it's not in use. :P
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