Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make an animation play when a player joins? (READ DESCRIPTION)

Take note that the animation is made from moon animator. The type of script is a LocalScript.

local StartVideo = game.ServerStorage.MoonAnimatorSaves["StartVideo.xsixx"]

if game.Players.PlayerAdded then queanimation = "StartVideo.xsixx" end

I'm trying to make it so that when a player joins, a camera animation from moon animator will play. But i'm thinking that the animation only ques for that player that joined, no one else. That is why I'm using a localscript. Please help me!

1 answer

Firstly, ServerStorage is not accessible by the client. I recommend putting it in ReplicatedStorage. Secondly, game.Players.PlayerAdded is a connection, not a boolvalue. Scripts automatically run in the client when the player joins unless disabled or not parented in running locations. Assuming that queanimation is already defined in a function, try to use this code

if not _G.ran then -- Since the script will run everytime the player resets
	_G.ran = true
	local StartVideo = game.ReplicatedStorage.MoonAnimatorSaves["StartVideo.xsixx"]
	queanimation = "StartVideo.xsixx"
end

2 comments

0

Running locations are StarterGui, StarterPack, StarterPlayerScripts, StarterCharacterScripts, and the player's character

0

I thought queanimation would make the animation que, it wasn't underlined, so i thought it'd work. It wasn't defined in a function. I'm trying to make the animation que when the player joins the game.

This discussion is preserved as it was. New answers, comments, and votes are closed.