Empty
Empty
Empty
StarterCharacterScripts is een container die scripts bevat die automatisch worden toegevoegd aan elk karaktermodel van een speler wanneer ze spawnen.
Empty
Empty
Empty
Scripts hier wijzigen meestal het karakter van de speler, zoals het aanpassen van bewegingsmechanismen, het toevoegen van speciale vaardigheden of het wijzigen van het uiterlijk en gedrag van het karakter.
Empty
Empty
Empty
-- 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
Als u deze tutorial nuttig vond en mijn werk wilt ondersteunen, overweeg dan om mij een kop koffie te kopen.
Hartelijk dank voor uw steun!
Koop een kop koffie voor mij