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

How to make a block move up and down?

(New to scripting so ill prob be posting here a lot)

Ive tried some tutorials but they dont seem to work.

Script:

local model = game.Workspace.MovingFish3
Local platform = model.Fish
local start = model.Start
local finish = model.End
local bodyPosition = Fish.bodyPosition



-----------------------------------------------------------------------------
while true do
	bodyPosition.position = Start.position
	wait(4)
	bodyposition.position = End.position
	wait(5)	
end

3 comments

1

Are you sure you spelled and capitalized everything correctly?

0

also, give us the error you're receiving.

0

the error i get in output says attempt to index global 'Start' (a nil value)

1 answer

One problem is that Position should be Capitalized Another is you aren't defining Fish you are defining platform.

local model = game.Workspace.MovingFish3
local platform = model.Fish
local start = model.Start
local finish = model.End
local bodyPosition = platform.bodyPosition -- Fish.bodyPosition -- Where are you defining Fish? Also is it bodyPosition or BodyPosition?

-----------------------------------------------------------------------------
while true do
    bodyPosition.Position = start.Position; -- Here
    wait(4);
    bodyposition.Position = finish.Position; -- And here .position should be .Position (You need to capitalize) 
    wait(5) ;
end;

That is the only problem I see with your code. If anyone else sees anything else feel free to comment and let me and the asker know. I hope this helped. If it did please accept this as the answer so that people know a solution has been found.

10 comments

0

Capitalized it and it still isn't working.

0

I edited my answer. I saw something else

0

Seems it's still not working, thank you for helping tho. I would give an upvote but I need more reputation.

0

is it platform.BodyPosition?

0

Normally when you insert it it's called BodyPosition not bodyPosition. Unless you renamed it.

0

it is BodyPosition and .BodyPosition

0

Try the fixed code and use .BodyPosition instead of .bodyPosition.

0

doesn't work

0

Hmm...

0

I fixed the code. A couple things. 1.) Look at variables you define when trying to call things. 2.) Variables are case-sensitive

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