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

How do I get this part to resize another part when a player touches part 1?

I'm trying to make a tycoon door, so when the player touches the brick, the brick becomes red and cant collide. Then it will make the base of the tycoon appear.

The only error I am getting (so far) is on line 4: Expected ')' (to close '(' at column 30), got ','

if script.Parent:GetTouchingParts(HumanoidRootPart) then
	script.Parent.CanCollide = false
	script.Parent.BrickColor.Name = "Really Red"
	game.Workspace.ty1ba.Size = (420.69 , 0.8 , 420.69)
end)
	

4 comments

0

Instead of saying GetTouchingParts, why don't you simply make a touched event instead?

0

And is the cancollide turning to false? What about the brickcolor?

0

that error is because you are not supposed to have a closing parenthesis on the end, since there is nothing for it to close

0

Once again, these errors are simple and easy to debug.

2 answers

✓ Accepted answer

The errors were pretty simple. You made a few mistakes.

##Mistakes:

  • You didn't use vector3 (Used for the positioning and sizing of an object)
  • You added an end with a parenthesis (An end with parenthesis should only be used with the :Connect function)
  • You cannot assign a name with a function such as BrickColor ##Fixed Script
if script.Parent:GetTouchingParts(HumanoidRootPart) then
	script.Parent.CanCollide = false
	script.Parent.BrickColor = BrickColor.new("Really red")
	game.Workspace.ty1ba.Size = Vector3.new(420.69, 0.8 , 420.69)
end

If you want it so that it gets it when they touch it, you can simply do this: ####Touched event

script.Parent.Touched:Connect(function(hit)
if script.Parent:GetTouchingParts(hit.Parent.HumanoidRootPart) then
	script.Parent.CanCollide = false
	script.Parent.BrickColor = BrickColor.new("Really red")
	game.Workspace.ty1ba.Size = Vector3.new(420.69, 0.8 , 420.69)
end
end)

If this answer fails to work, please comment so I can amend it!

Refined grammatical errors. Date: February 19, 2021

1 comment

0

the touched one is what i needed thanks

First of all, you had a closing parenthesis on the end) which will cause an error since it's not needed.

So let's have an example here of how you should have the script set up:

local part2 = workspace.Part2

script.Parent.Touched:connect(function(touched)
	if touched.Name == "HumanoidRootPart" and touched.Parent:FindFirstChild("Humanoid") then 
		part2.Size = Vector3.new(5,5,5)
		part2.BrickColor = BrickColor.Red()
		part2.CanCollide = false
	end
end)

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