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

why doesnt this work and fix?

Asked by
3x6x0 0
8 years ago

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())

0
it says stuff like this Workspace.Part.Script:4: ')' expected near ',' 3x6x0 0 — 8y

1 answer

Log in to vote
0
Answered by
Necrorave 560 Moderation Voter
8 years ago

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.

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 3x6x0 0 — 8y
0
Try it again, I also noticed you had something extra on Line 6. Let me know if it works now. Necrorave 560 — 8y
0
didnt work no errors but nothing happens maybe ill add more force 3x6x0 0 — 8y
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. Necrorave 560 — 8y
View all comments (9 more)
0
im trying to shrink the house dat i made but dis time same thing no errors but did nothing 3x6x0 0 — 8y
0
This script isn't going to shrink anything. This is just moving the location of the object. Necrorave 560 — 8y
0
wat would i use to shrink it and what code would i use 3x6x0 0 — 8y
0
do u no 3x6x0 0 — 8y
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 :) Necrorave 560 — 8y
0
i just copy and paste:3 so i dont have to rite tuns of stuff 3x6x0 0 — 8y
0
Be sure to accept the answer if this helped! Necrorave 560 — 8y
1
i just thought of it or how to bc of u thx alot:D 3x6x0 0 — 8y
0
Nice, Good luck! Necrorave 560 — 8y
Ad

Answer this question