✓ Accepted answer
You can pass a parameter through the function. Such as so:
script.Parent.Touched:Connect(function(PartThatTouched)
print("something touched this, it's name is: "..PartThatTouched.Name)
game.Workspace.Baseplate.BrickColor = BrickColor.Random()
end)
if you wanna make sure it is a player that touched this or anything that has a humanoid what you can do is:
script.Parent.Touched:Connect(function(PartThatTouched)
print("something touched this, it's name is: "..PartThatTouched.Name)
if PartThatTouched.Parent:FindFirstChild("Humanoid") then
game.Workspace.Baseplate.BrickColor = BrickColor.Random()
end
end)
1 comment
thx