Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to change the color of the character's body parts, remove pants, destroy accessories, update the shirt template, and set animations
- local function modifyCharacter(character, color, newShirtTemplate, idleAnimationId, walkRunAnimationId)
- -- Remove pants
- local pants = character:FindFirstChildOfClass("Pants")
- if pants then
- pants:Destroy()
- end
- -- Destroy all accessories
- for _, accessory in pairs(character:GetChildren()) do
- if accessory:IsA("Accessory") then
- accessory:Destroy()
- end
- end
- -- Change the color of the body parts
- for _, part in pairs(character:GetChildren()) do
- if part:IsA("BasePart") then
- part.Color = color
- end
- end
- -- Update the existing shirt template
- local shirt = character:FindFirstChildOfClass("Shirt")
- if shirt then
- shirt.ShirtTemplate = newShirtTemplate
- end
- -- Set the animations
- local humanoid = character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- -- Idle Animation
- local idleAnimation = Instance.new("Animation")
- idleAnimation.AnimationId = "rbxassetid://" .. idleAnimationId
- local idleAnimationTrack = humanoid:LoadAnimation(idleAnimation)
- idleAnimationTrack:Play()
- -- Walk/Run Animation
- local walkRunAnimation = Instance.new("Animation")
- walkRunAnimation.AnimationId = "rbxassetid://" .. walkRunAnimationId
- local walkRunAnimationTrack = humanoid:LoadAnimation(walkRunAnimation)
- humanoid.WalkSpeed = 16 -- Set a default walk speed if needed
- humanoid.Running:Connect(function(speed)
- if speed > 0 then
- walkRunAnimationTrack:Play()
- else
- walkRunAnimationTrack:Stop()
- end
- end)
- end
- end
- -- Get the player and their character
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- -- Set the desired color, new shirt template, and animation IDs
- local redColor = Color3.fromRGB(255, 0, 0)
- local newShirtTemplate = "rbxassetid://15724447914" -- Use the asset ID directly
- local idleAnimationId = "18631254999"
- local walkRunAnimationId = "18631265977"
- -- Modify the character
- modifyCharacter(character, redColor, newShirtTemplate, idleAnimationId, walkRunAnimationId)
- -- Listen for character respawn to apply the changes again
- player.CharacterAdded:Connect(function(newCharacter)
- modifyCharacter(newCharacter, redColor, newShirtTemplate, idleAnimationId, walkRunAnimationId)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement