I created an animation with a welded object and did some scripting for it to work on a loop (for testing purposes) when a player joins.
When I join, the animation works fine but the ball is not present. Is there any way to make the ball appear, preferably without making it a tool?
I don’t think this has anything to do with the script as it works fine, but here it is just in case:
-- Get player
local player = game:GetService("Players").LocalPlayer
-- Wait for animation
local animation = script:WaitForChild("Animation")
-- Make this variable local
local animDribbleRTrack = nil
-- Make a function that takes a character and loads an animation on it
-- Then sets the animDribbleRTrack variable to be that animation
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
animDribbleRTrack = animator:LoadAnimation(animation)
end
-- If there is already a character, then load the animation on it
if player.Character then
onCharacterAdded(player.Character)
end
-- When the player gets a new character, load the animation on it
player.CharacterAdded:Connect(onCharacterAdded)
-- Every 5 seconds, if there is an animation, play it
while true do
task.wait(5)
if animDribbleRTrack then
animDribbleRTrack:Play()
end
end