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: FirstChild script doesn't work (help please)

Previous Thread :: Next Thread 
JosephDusk is not online. JosephDusk
Joined: 08 Jun 2010
Total Posts: 1146
03 Jul 2013 08:43 AM
It's a script so the car tire will adapted based on the brick material the wheels touch, It will run, but the script doesn't change the friction for some reason?

Here is the script:

while true do
wait(.25)
function findRandomChild(model)
return A == script.Parent.Parent.Wheels:children()[math.random(1,#model:children())]
end
function onTouch(hit)
if hit.Material == "Grass" or "Slate" or "Ice" then
local children = Workspace:GetChildren()
for i = 1, #children do
children[i].Friction = ".25"
end
end
if hit.Material == "Concrete" then
local children = Workspace:GetChildren()
for i = 1, #children do
children[i].Friction = ".75"
end
else
children[i].Friction = ".50"
script.Parent.Touched:connect(onTouch)
end
end
end
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Jul 2013 09:01 AM
Here is a fix on what you did wrong, the script will still not work because you are missing something, something to call the other functions and I do not know what this script is accualy supposed to do:


function findRandomChild(model)
return A == script.Parent.Parent.Wheels:GetChildren()[math.random(1,#model:GetChildren())]
end
function onTouch(hit)
if hit.Material == "Grass" or "Slate" or "Ice" then
local children = Workspace:GetChildren()
for i = 1, #children do
children[i].Friction = .25
end
end
if hit.Material == "Concrete" then
local children = Workspace:GetChildren()
for i = 1, #children do
children[i].Friction = .75
end
else
children[i].Friction = .50
script.Parent.Touched:connect(onTouch)
end
end
while wait(.25) do
--something here
end
Report Abuse
JosephDusk is not online. JosephDusk
Joined: 08 Jun 2010
Total Posts: 1146
03 Jul 2013 09:47 AM
Bump, someone help please?
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Jul 2013 09:48 AM
Did not I just help you a bit? I know it is not fully working but I have removed the errors.
Report Abuse
JosephDusk is not online. JosephDusk
Joined: 08 Jun 2010
Total Posts: 1146
03 Jul 2013 09:54 AM
A slight bit, but I need it to work :/
Report Abuse
JosephDusk is not online. JosephDusk
Joined: 08 Jun 2010
Total Posts: 1146
03 Jul 2013 02:53 PM
Bump, help please?
Report Abuse
JosephDusk is not online. JosephDusk
Joined: 08 Jun 2010
Total Posts: 1146
03 Jul 2013 04:53 PM
Help please
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