Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago
Edited 8 years ago

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

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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) 
0
thanks i'll try it lce_bear 31 — 8y
0
it works! Thanks! lce_bear 31 — 8y
0
yw! dragonkeeper467 453 — 8y
Ad

Answer this question