Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local humanoid = player.Character:WaitForChild("Humanoid")
- local isSlowMotion = false -- Tracks the slow-motion state
- local slowMotionSpeed = 0.3 -- Adjust this value to control the slow speed
- local normalSpeed = 1 -- The default playback speed for emotes
- -- Button setup (Assume a TextButton named "ToggleButton" exists in a ScreenGui)
- local toggleButton = script.Parent:WaitForChild("ToggleButton")
- -- Function to toggle slow motion
- local function toggleSlowMotion()
- isSlowMotion = not isSlowMotion
- -- Loop through all animations being played on the humanoid
- for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do
- if isSlowMotion then
- track:AdjustSpeed(slowMotionSpeed) -- Slow down the emote
- else
- track:AdjustSpeed(normalSpeed) -- Return to normal speed
- end
- end
- -- Update button text to reflect current state
- if isSlowMotion then
- toggleButton.Text = "Turn Off rizz Motion"
- else
- toggleButton.Text = "Turn On rizz Motion"
- end
- end
- -- Connect the button click to the toggle function
- toggleButton.MouseButton1Click:Connect(toggleSlowMotion)
- -- Optional: Listen for when new animations are played and adjust speed accordingly
- humanoid.AnimationPlayed:Connect(function(animationTrack)
- if isSlowMotion then
- animationTrack:AdjustSpeed(slowMotionSpeed)
- end
- end)
Advertisement
Advertisement