Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this script not work the way I want it to?

I'm trying to make the brick named Ball turn into the Beachball mesh when it touches the brick this script is in but other bricks not named Ball keep turning into the Beachball mesh also. How do I make that stop?

z = script.BeachBallMesh

function onTouched(Ball) 
z = z:clone() 
z.Parent = Ball  
end 
script.Parent.Touched:connect(onTouched) 

1 answer

✓ Accepted answer

You can just make sure the brick named "Ball" is the only one that gets the mesh with an if statement

z = script.BeachBallMesh

function onTouched(Ball) 
if(Ball.Name == "Ball") then --check if the name of the part that touched is "Ball"
z = z:clone() 
z.Parent = Ball  
end 
end
script.Parent.Touched:connect(onTouched) 

3 comments

0

thanks i'll try it

0

it works! Thanks!

0

yw!

This discussion is preserved as it was. New answers, comments, and votes are closed.