Moving Block Not Working

Ps: Sorry if this is simple, I am a rookie at scripting

Hello, I made a script and it is supposed to change the position of the part but its not working.
Script:

local changeofvelocity = 1
wait(5)
local part = game.Workspace.Part
while true do
	part.Position.Y = part.Position.Y +changeofvelocity
	wait(3)
end

All help appreciated!

You can’t set the properties of a Vector3. They’re read-only. You would have to create a new Vector3 to apply a change to the position like that. Here’s a quick code-sample demonstrating how you might do that:

local changeofvelocity = Vector3.new(0, 1, 0)
wait(5)
local part = game.Workspace.Part
while true do
	part.Position = part.Position + changeofvelocity
	wait(3)
end

You can find more information on Vector3s on the wiki: Vector3 | Documentation - Roblox Creator Hub

2 Likes

I believe, and anyone correct me if I’m wrong, but you can not individually change the x,y,z of any part by themselves by the way you are doing. You could just do
part.Position = part.Position + Vector3.new(0, changeofvelocity, 0)

Thanks for the help yall! You all helped me I just put the Solution on the first comment, thanks.

You’re correct, if you try to set the x,y,z values of an object it will throw an error at you: y cannot be assigned to.