Trying to make A Remote Event, that Loads Emote

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I want to Fire A Server Remote Event to LoadAnimation (i’m trying to make a Emotes)

  2. What is the issue? Include screenshots / videos if possible!
    I Have no clue how to realise that…

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I didn’t found something about this problem

and i have the module script to Get the emotes from it:

local EmotesModule = {
	SwordHit = {
		Animation = script.Animations["Hit"];
		Tool = script.Tools["Hit"]:Clone();
		Sound = script.Sounds["Hit"];
		Looped = true;
		EmoteStart = function(character: Model, tool: BasePart)
			local hum: Humanoid = character:FindFirstChild("Humanoid");
			
			if character and character:FindFirstChild("Right Arm") then
				local weld = Instance.new("Motor6D", tool);
				weld.Name = "Hit Motor";
				weld.Part0 = tool;
				weld.Part1 = character:FindFirstChild("Right Arm");
				
				tool.Parent = character;
			end;
			
			if hum then
				local animator: Animator = hum:FindFirstChild("Animator");
				local track = animator:LoadAnimation(script.Animations.Hit);
				track.Looped = true;
				track:Play();
			end;
			
		end,
		EmoteEnd = function(character: Model, tool: BasePart)
			if character then
				local animator: Animator = character:FindFirstChild("Humanoid").Animator;
				
				for _, track: AnimationTrack in pairs(animator:GetPlayingAnimationTracks()) do
					if track.Animation.Name == "Hit" then
						track:Stop();
					end;
				end;
				
				for _, motor6d: Instance in pairs(character:GetDescendants()) do
					if motor6d:IsA("Motor6D") and motor6d.Name == "Hit Motor" then
						motor6d:Destroy();
					end;
				end;
				tool:Destroy();
			end;
		end,
	}
}

return EmotesModule;

Thanks for help!

You arent supposed to ask for full scripts, but i’ll give you one anyways.

Local / Client script in StarterCharacterScripts:

cooldown = false

local player = game.Players.LocalPlayer

local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()

local animation = Instance.new("Animation")


animation.AnimationId = "http://www.roblox.com/asset/?id=" --Add your anim ID 
 

mouse.KeyDown:connect(function(key)
	if key == "e" then --the key you want the emote to play
		if not cooldown then
			cooldown = true
			local playanim = humanoid:LoadAnimation(animation)
			playanim:Play()
			wait(0.1)
			cooldown = false
		end
	end
end)

here you go.

1 Like

Thanks for trying to help me, but i have the animation with Parts/Items, and i want to Fire Remote Event to set the parent of items to character from server, and i have a ModuleScript for that

local EmotesModule = {
	SwordHit = {
		Animation = script.Animations["Hit"];
		Tool = script.Tools["Hit"]:Clone();
		Sound = script.Sounds["Hit"];
		Looped = true;
		EmoteStart = function(character: Model, tool: BasePart)
			local hum: Humanoid = character:FindFirstChild("Humanoid");
			
			if character and character:FindFirstChild("Right Arm") then
				local weld = Instance.new("Motor6D", tool);
				weld.Name = "Hit Motor";
				weld.Part0 = tool;
				weld.Part1 = character:FindFirstChild("Right Arm");
				
				tool.Parent = character;
			end;
			
			if hum then
				local animator: Animator = hum:FindFirstChild("Animator");
				local track = animator:LoadAnimation(script.Animations.Hit);
				track.Looped = true;
				track:Play();
			end;
			
		end,
		EmoteEnd = function(character: Model, tool: BasePart)
			if character then
				local animator: Animator = character:FindFirstChild("Humanoid").Animator;
				
				for _, track: AnimationTrack in pairs(animator:GetPlayingAnimationTracks()) do
					if track.Animation.Name == "Hit" then
						track:Stop();
					end;
				end;
				
				for _, motor6d: Instance in pairs(character:GetDescendants()) do
					if motor6d:IsA("Motor6D") and motor6d.Name == "Hit Motor" then
						motor6d:Destroy();
					end;
				end;
				tool:Destroy();
			end;
		end,
	}
}

return EmotesModule;

Okay. Ill make a script for remote event.

Local script in StarterCharacterScripts:

cooldown = false

local player = game.Players.LocalPlayer

local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()


local RemoteEvent = game.ReplicatedStorage.Emote --Change this to wherever / whatever your remote event is


mouse.KeyDown:connect(function(key)
	if key == "e" then --the key you want the emote to play
		if not cooldown then
			cooldown = true
			RemoteEvent:FireServer()
			wait(0.1)
			cooldown = false
		end
	end
end)

Insert script inside ServerScriptService and make an Animation inside the script. (If you dont already have a way to load the animation)

Screenshot 2022-10-27 154436

Server / Script in ServerScriptService:

local RemoteEvent = game.ReplicatedStorage.Emote

RemoteEvent.OnServerEvent:Connect(function(plr)
	local Character = plr.Character
	local Humanoid = Character:WaitForChild("Humanoid")
	
	local Anim = script.Animation
	local LoadAnim = Humanoid:LoadAnimation(Anim)
	
	LoadAnim:Play()
end)

This should work.

1 Like

i also was thinking about this method, but i think exploiters can actually abuse it :frowning:

Anyways i’ll try that in my game

animations can be loaded and ran from the client, and they will replicate
if exploiters really wanted to abuse your animations, they would just skip the remote tbh

1 Like

i think they can use someone as the argument to play the animation by them

i want to parent the parts to the character, because i have Emote with Parts, and i need an Server Event for that, but i want to make server event that, exploiters don’t abuse it

Omg, you were right, i can’t run Remote Events on other people, i can run them only on myself! Thanks for help!

I thought you can? With :FireAllClients ? (Ohh, you meant for other people not everyone sorry

1 Like

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