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

How would I make different parts change when a player touches something?

Asked by 5 years ago
Edited 5 years ago

When a player touches a part, I want other parts to change.

I'm not trying to change the transparency, color, or whether or not the part is anchored, I'm trying to make the parts change completely into for example multiple wedges.

I know one of the first lines of the script is:

game.Workspace.PARTNAME.Touched:Connect(function()

0
Have your parts assigned a particular name that your script will look for and just do a game.Workspace.PARTNAME really. Not sure what exactly you're asking for since your question doesn't elaborate all that much. M39a9am3R 3210 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

No fear I am here!

hum = workspace.ChildAdded:Connect(function(child)
if child:IsA("Model") and child.Humanoid then return child end
end)

connection = hum.Touched:Connect(function(part)
if part:IsA("BasePart") and part.CanCollide == true then
part.Shape = math.random(0,2) -- a ball, cylinder, block etc.
else return false
end
end)

-- you may want to disconnect after you're done ;)

This simply generates random part types when you touch other parts.

Ad

Answer this question