StarterCharacterScript

StarterCharacterScripts es un contenedor que almacena scripts que se añaden automáticamente al modelo de personaje de cada jugador cuando aparece.

Los scripts aquí típicamente modifican el personaje del jugador, como cambiar las mecánicas de movimiento, agregar habilidades especiales o modificar la apariencia y comportamiento del personaje.

-- 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

Si encuentras útil este tutorial y deseas apoyar mi trabajo, considera invitarme a un café.

¡Muchas gracias por tu apoyo!

Invítame a un café