로블록스 개발 2단계

Oak_Cassia·2022년 5월 13일
0

로블록스 개발기

목록 보기
2/5

사라지는 블록

Transparency와 CanCollide를 이용해서 사라지는 블록을 만들었다. 이를 응용해 아래와 같은 것들을 만들었다.

  1. 투명해지면 충돌도사라지는 파트
  2. 투명해져도 충돌이 남는 파트
  3. 사라지는 것에 간격을 두어 통과할 수 있는 구간

체크포인트 만들기

local spawn = script.Parent
spawn.Touched:connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
		if not checkpointData then
			checkpointData = Instance.new("Model", game.ServerStorage)
			checkpointData.Name = "CheckpointData"
		end

		local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
		if not checkpoint then
			checkpoint = Instance.new("ObjectValue", checkpointData)
			checkpoint.Name = tostring(player.userId)

			player.CharacterAdded:connect(function(character)
				wait()
				character:WaitForChild("HumanoidRootPart").CFrame = game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
			end)
		end

		checkpoint.Value = spawn
	end
end)

위 스크립트를 파트에 추가해주면 된다.


profile
rust로 뭐할까

0개의 댓글