StarterCharacterScript

StarterCharacterScripts는 플레이어가 생성될 때마다 플레이어의 캐릭터 모델에 자동으로 추가되는 스크립트를 보관하는 컨테이너입니다.

여기에 있는 스크립트는 플레이어의 캐릭터를 수정하는 데 사용되며, 예를 들어 이동 메커니즘을 변경하거나 특별한 능력을 추가하거나 캐릭터의 외형과 행동을 수정하는 데 사용됩니다.

-- StarterCharacterScripts > CustomJumpScript

local ContentProvider = game:GetService("ContentProvider")

local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")

	local jumpAnimation = Instance.new("Animation")
	jumpAnimation.AnimationId = "rbxassetid://97611958527430"

	-- Preload the animation to check if it exists
	local success, errorMessage = pcall(function()
		ContentProvider:PreloadAsync({jumpAnimation})
	end)

	if success then
		print("Animation asset exists and has been preloaded successfully.")

		local animationTrack = humanoid:LoadAnimation(jumpAnimation)
		animationTrack.Priority = Enum.AnimationPriority.Action  -- Set the priority on the AnimationTrack

		local function playCustomJump()
			animationTrack:Play()
		end

		humanoid.Jumping:Connect(playCustomJump)

	else
		warn("Failed to load animation asset: " .. errorMessage)
	end
end

local player = game.Players.LocalPlayer
player.CharacterAdded:Connect(onCharacterAdded)

if player.Character then
	onCharacterAdded(player.Character)
end

이 튜토리얼이 도움이 되셨다면, 저의 작업을 지원하기 위해 커피 한 잔을 사주시면 감사하겠습니다.

지원해 주셔서 정말 감사합니다!

커피 한 잔 사주기