slider

hi, i got this script im working on for half the day here and still stuck on it… im not any good with scripting and im still learning … here is the script:

if (collider.gameObject == " ice ")
           transform.Translate(0,0,8);
}

the " ice " is the game object btw…what i want is for the player to have the player walk on this patch of ice and suddenly go super fast in the direction they is going … any help with this would be great Thanks :slight_smile:

forgot to mention im also using the locomotion system for walking/stepping animations… maybe that is why ?

Is that the whole script? That piece of code is not likely to do much if anything by itself.

If there’s more to the script than that, perhaps you can post it and explain what kinds of problems you are having with it. Otherwise, more detail about what is going on in the game will be required - it’s a bit hard to suggest anything based on what you’ve posted.

thanks for replying… that is in fact the whole code that i place on my player controller… the tag “ice” is the name of the game object in the hierarchy… like i said b4, im just learning … the transform.translate line seems to work on a game object that is not a player though …that is why im attempting to use it on my player controller …any more help would be much appreciated and then my production time on my first game will be shorter…thanks again

You can’t compare a GameObject to a String – they’re different types. What you want is

if (collider.gameObject.name == "ice")
           transform.Translate(0,0,8);
}

(note also that I took out the extra spaces around the object name).

Awesome ! Thanks, you made my day ! :slight_smile: