Roblox Script - Part Movement

숲사람·2024년 1월 1일

Falling & Rotating Part

local rotationSpeed = 20

local function rotateBlock()
	while true do
		script.Parent.CFrame = script.Parent.CFrame * 
			CFrame.Angles(
				math.rad(rotationSpeed), 
				math.rad(rotationSpeed), 
				math.rad(rotationSpeed)
			)
		wait(0.1)
	end
end

rotateBlock()

Floating & Rotating & Modifying Color


local desiredHeight = 100
script.Parent.Anchored = true

script.Parent.Position = Vector3.new(script.Parent.Position.X, desiredHeight, script.Parent.Position.Z)

local function floatBlock()
	while true do
		script.Parent.CFrame = script.Parent.CFrame * 
			CFrame.Angles(
				math.rad(rotationSpeed), 
				math.rad(rotationSpeed), 
				math.rad(rotationSpeed)
			)
		script.Parent.BrickColor = BrickColor.Random() -- shift color 
		wait(0.1)
	end
end
floatBlock()

Changing Size

script.Parent.Anchored = true
local bigBlock = script.Parent
bigBlock.Size = Vector3.new(3, 3, 3)

local function increase() 
	repeat
		bigBlock.Size = bigBlock.Size + Vector3.new(1, 0, 0)
		wait(0.1)
	until bigBlock.Size.X > 150   -- 조건이 true 될때 까지
end

increase()

Moving x축

local function moving() 
	while workspace.moving_part.Position.X < 0 do
		workspace.moving_part.Position = workspace.moving_part.Position + Vector3.new(1,0,0)
		wait(0.05)
	end 
end

moving()
profile
기록 & 정리 아카이브용

0개의 댓글