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 an part rise/move at a certain time?


Hi! I'm new here, but ive been studying this site for a while so I know to not just ask how to script. I've been researching for several months in hopes to make a decent game. Trying to study Lua coding. Hopefully you all are safe and doing well. Anyway-

Let me give you some backstory. The game I want to make requires all players to start in a tube looking object. The bottom part will push the player up into the arena, similar to hunger games. Now I have a script for this already, but the script I've made only allows the tubes to rise with a a button. I would like to make a countdown timer, and once the countdown arrives the types automatically rise. Heres the current script I have... (sorry im new to this so i dont know how to put this like a code in line, can anyone help me with that as well)

Thanks for reading, and helping.

model = game.Workspace.Tubes
script.Parent.ClickDetector:Destroy()
for i=1,646 do
for number, part in pairs (model:GetChildren()) do
if part.Name == "Part" then
part.CFrame = part.CFrame + Vector3.new(0,.2,0)
end
end
wait (0.05)
end
end)

4 comments

0

Use code blocks

0

Hello. Please format your code by pressing the Lua button. Your code is impossible to read.

0

okay fixed it! :)

0

Use TweenService.

2 answers

You could have a boolean value in the workspace called "gameStarted" or something like that, and have the bottom part move upwards when it changes to true, maybe something like this:

model = game.Workspace.Tubes
value = workspace.gameStarted
value.Changed:Connect(function()
	if value.Value then
		for i=1,646 do 
			for number, part in pairs (model:GetChildren()) do 
				if part.Name == "Part" then 
					part.CFrame = part.CFrame + Vector3.new(0,.2,0) 
				end 
			end 
			wait(0.05) 
		end
	end
end)

after the timer reaches 0 you would change the gameStarted value to true

1 comment

0

Thank you! I will try this in a few minutes!


Hey Its not working, I added a boolvalue to the workspace and put the script under boolvalue, and under that I did the countdown

local gameStarted = true
if gameStarted == true then
else
end
--GAME STARTING--

print(GameStartingMsg) 
local Msg = Instance.new("Message")

Msg.Parent = game.Workspace
for a=5,1,-1 do
Msg.Text="Game is starting! "..a
wait(1)
end
Msg.Text = "Game starting!"
wait(2)
Msg:remove()
game.Lighting.MAPNAME:()

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