Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make all seats with the same name play the same animation?

Asked by
ka3r 14
5 years ago
01-- Server Script
02 
03local Players = game:GetService("Players") -- Our player service to use the PlayerAdded & CharacterAdded events.
04local SitIdleAnim = 2506281703 -- Set to your specified animation id to replace the default sit animation.
05 
06local Seats = {
07[workspace:FindFirstChild('Seat1', true)] = 4623559126;
08[workspace:FindFirstChild('Seat2', true)] = 913402848;
09}
10-- For each seat as the key, the value will the animation you want to play
11 
12Players.PlayerAdded:Connect(function(Player) -- On player added
13    Player.CharacterAdded:Connect(function(Character) -- When character is added
14    local Animation = Character:FindFirstChild('SitAnim', true) -- Finding the sit animation in the character
15    local Humanoid = Character.Humanoid -- So we can use the GetPropertyChangedSignal
View all 26 lines...

I currently have this script which allows seat1 to play a resting animation and seat2 to play a walking animation.

Upon cloning and having multiple seats named "seat1" and "seat2", the original seat1 works fine; plays the correct animation and same goes for original seat2. The cloned seats however plays the "SitIdleAnim". The cloned and original seats are both the same; I used Ctrl+D, didn't change the name.

How would the script be altered/changed/edited to be able to allow every seat named "seat1" to play the "seat1" animation and same goes for seat2?

Thanks in advance. - Sorry if I formatted this wrong, I'm a new user learning the basics of ScriptingHelpers. Please tell me if you don't understand.

Answer this question