-- Server Script local Players = game:GetService("Players") -- Our player service to use the PlayerAdded & CharacterAdded events. local SitIdleAnim = 2506281703 -- Set to your specified animation id to replace the default sit animation. local Seats = { [workspace:FindFirstChild('Seat1', true)] = 4623559126; [workspace:FindFirstChild('Seat2', true)] = 913402848; } -- For each seat as the key, the value will the animation you want to play Players.PlayerAdded:Connect(function(Player) -- On player added Player.CharacterAdded:Connect(function(Character) -- When character is added local Animation = Character:FindFirstChild('SitAnim', true) -- Finding the sit animation in the character local Humanoid = Character.Humanoid -- So we can use the GetPropertyChangedSignal Humanoid:GetPropertyChangedSignal('SeatPart'):Connect(function() local AnimationValue = Seats[Humanoid.SeatPart] -- if the part exists in the table as a key if not AnimationValue then -- if it's not then we'll set it to our idle animation Animation.AnimationId = ('rbxassetid://%s'):format(SitIdleAnim) else -- else if the animation does exist then it'll set to it's value that's in the table Animation.AnimationId = ('rbxassetid://%s'):format(AnimationValue) end end) end) end)
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.