로블록스 스튜디오로 뭔가 게임을 만들때
가장 먼저 필요한 것이 점수를 어떻게 만들어 줄까? 입니다.
왜 이렇게 되는지는 하다보다 하나씩 알게 되지 않을까 하고 일단 점수를 만드는 법을 그냥 알려드려요
1. 로블록스 스튜디오를 실행하시고
2. script를 ServerScriptService 아래 하나 추가하세요.
3. 그리고 아래 코드를 붙여보세요
local function onPlayerJoin(player)
print ("Player ID : ", player.UserId)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local score = Instance.new("IntValue")
score.Name = "score"
score.Value = 0
score.Parent = leaderstats
local score = Instance.new("IntValue")
score.Name = "HP"
score.Value = 100
score.Parent = leaderstats
print ("test to read score")
wait (10)
print ("after 10 ")
player.leaderstats.score.Value = 5
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
내용은 아래 동영상에서 살펴보세요.
'Roblox Script' 카테고리의 다른 글
#7 : Remote Event로 클라이언트에서 서버 호출하기 (0) | 2020.08.02 |
---|---|
#6 - 효과음 넣기 (Sound effect) (0) | 2020.08.02 |
#4 : 블록 만지면 점수 올리기 (0) | 2020.08.02 |
#3 - 무한 반복 블록 생성 (0) | 2020.08.02 |
#2 : 블록 복사하기 - 하늘에서 블록이 떨어지기 (0) | 2020.08.02 |