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

why doesnt this work and fix?

i cant make a house become tiny this is my code:

 local pos = game.Workspace.Union.BodyPosition
local function closeInOnPlayer()
	wait(2)
	pos.Position = (14.615, 0.5, -35.65)
end
script.Parent.Touched:connect(closeInOnPlayer())

1 comment

0

it says stuff like this Workspace.Part.Script:4: ')' expected near ','

1 answer

✓ Accepted answer

When manipulating something that has multiple values assigned to it like Position you must use Vector3

Vector3 takes 3 values. x, y, x. Also what you know as a Position in the Workspace.

Using your code:

 local pos = game.Workspace.Union.BodyPosition
local function closeInOnPlayer()
    wait(2)
    pos.Position = Vector3.new(14.615, 0.5, -35.65) -- Added 'Vector3.new'
end
script.Parent.Touched:connect(closeInOnPlayer) --Got rid of parenthesis


Give this a try and let me know if it works!

More info on Vector3: http://wiki.roblox.com/index.php?title=Vector3

EDIT: I also noticed you called your function incorrectly on Line 6. I got rid of the parenthesis for you.

13 comments

0

didnt work i went on it multiple times and it said 17:21:06.200 - Attempt to connect failed: Passed value is not a function 17:21:06.200 - Script 'Workspace.Part.Script', Line 6 17:21:06.201 - Stack End 17:21:09.066 - attempt to call a nil value 17:21:09.169 - attempt to call a nil value 17:21:12.062 - attempt to call a nil value

0

Try it again, I also noticed you had something extra on Line 6. Let me know if it works now.

0

didnt work no errors but nothing happens maybe ill add more force

0

Your code is just moving the object to a new location. Not sure what else you are trying to do. You may need to be more clear in your question.

0

im trying to shrink the house dat i made but dis time same thing no errors but did nothing

0

This script isn't going to shrink anything. This is just moving the location of the object.

0

wat would i use to shrink it and what code would i use

0

do u no

0

That is a lot more complex than you may be able to handle. It is also a lot of work. Unfortunately, I will not be able to help you with that. Although, I did fix what you provided at least. Good luck :)

0

i just copy and paste:3 so i dont have to rite tuns of stuff

0

Be sure to accept the answer if this helped!

1

i just thought of it or how to bc of u thx alot:D

0

Nice, Good luck!

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