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

I used a local script to move my part but it doesn’t work?

Asked by
CedCed6 32
4 years ago

I want to move my part when a player joins. I used a local script and I used this code:

local part = script.Parent

repeat wait() until game:IsLoaded()

part.Position = 60, 120, 4

4 answers

Log in to vote
1
Answered by
Vathriel 510 Moderation Voter
4 years ago

Position is a Vector3 value, you need to use:

part.Position = Vector3.new(60,120,4)

For future reference most of the time things like this can be caught in the output window.

Good luck!

0
Thanks you so much. CedCed6 32 — 4y
Ad
Log in to vote
1
Answered by
2Loos 168
4 years ago

Use Vector3.new() because position is a value with 3 digits to it. Changed script:

local part = script.Parent

repeat wait() until game:IsLoaded()

part.Position = Vector3.new(60,120,4)
0
Thank you. CedCed6 32 — 4y
Log in to vote
1
Answered by 4 years ago

The issue is you are not using vector3.new

So your script could look like this

``script.parent.position = vector3.new(60,120,4)

0
Thank you. CedCed6 32 — 4y
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Make sure that the script isn't directly in the part, and that it is in either starterpack, startergui, or starterplayer.

To move it you should use Vector3 to do it. Replace

part.Position = 60, 120, 4

with this:

part.Position = Vector3.New = (60, 120, 4)
0
Thank You. CedCed6 32 — 4y

Answer this question