How to make custom /e dances

Hello everyone.

So what I’m trying to do is implement custom /e dances into my game. If I will be honest I can’t figure out how to do it, I have all the animations ready I just need to find a way to make it so I can do a custom /e __ and it plays my custom emote. e.g /e sit – makes the player sit down

If possible as well how do you make this behind a paywall as in how do you make it so a game pass is needed to be able to do these custom /e - emotes

I have tried to look online and through the dev-forum and have come across nothing or outdated tutorials or ones that do not fit my needs.

Any help would be appreciated thank you :slight_smile:

Maybe you will find this topic helpful on how to do it:

Thanks for the response, I have tried this one but again it isn’t really suiting what I need I suppose I could use it and modify it though

Okay, I will look more into scripting with the roblox chat and see if I can replicate something that might fit what you need.

Thank you that would be amazing if you’d be able to do something like that!

I got some code that may help you:

local StringToDetect = ":e" -- chat errors come if it is a slash.
local animations = {"Emote1", "Emote2"} -- replace these with the emotes you have
local animationids = {"EmoteID", "EmoteID2"}
--PUT THE NAME OF THE ANIMATION AND THEN THE ID WITH NO SPACE LIKE THIS:
--local animations = {"DanceOne"}
--local animationids = {"DanceOne1023573203"} 

local function GetID(Message, Animation, Table)
	for i, v in ipairs(Table) do
		if string.find(string.lower(v), string.lower(Animation)) ~= nil then
			print(tostring((string.gsub(string.lower(v), string.lower(Animation), ""))))
			return tostring((string.gsub(string.lower(v), string.lower(Animation), "")))
		end
	end
end

game:GetService("Players").LocalPlayer.Chatted:Connect(function(Message)
	print("Messaged")
	local said = string.find(string.lower(Message), string.lower(StringToDetect))
	if said ~= nil then
		print("Said :e")
		for i, v in ipairs(animations) do
			local animation = string.find(string.lower(Message),string.lower(v))
			print(animation)
			if animation ~= nil then
				local animid = GetID(Message, v, animationids)
				local animationobject = Instance.new("Animation")
				animationobject.AnimationId = "rbxassetid://" .. tostring(animid)
				local loadedanim = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(animationobject)
				loadedanim:Play()
			end
		end
	end
end)

Sorry for the wait, I still have school going on and stuff. lmk if this works out. make sure that the animations match up with the body type if it is r6 or r15.

5 Likes

Hey, sorry I apologize for very long delay I’m not the best with scripting but for this script to work where am I placing it? As well as the animations etc if you understand what I mean

1 Like

So for the place where you put the script, it is a local script under starterplayer scripts. Also I was worried that the script would only play the animations so that the player doing the animation would see it and others wouldn’t but it turned out to work. And for the animations, all you have to do is put the name of the emote in the animations table and then the name in the animationids table along with the animation id right after it without a space as the animation instance is made and its id gets changed to the correct emotes id. So no need to worry about putting animations anywhere in the workspace. So unless you wanted to have an animation folder that it would get animation instances from instead of creating the instances through a script then I could try and modify the script to go off of the animations in a folder or something instead.

and something important to note about putting the animations into the tables is that if you placed the name in slot one of the table, then you should also put the name and id part in slot 1 of the other table too. This also goes with if you put the name in second or third in the table.

If you have any more questions or want me to do the way where you have an animation folder instead then just let me know.

also you can remove the print statements in the script.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.