Animation Events and Remote Event

I’m trying to make footstep sounds with animation events and a Remote Event, but im trying to also make the footstep sound play based on the material, but isn’t working.

Local Script at PlayerGUI

game.Players.LocalPlayer.Character.Humanoid.AnimationPlayed:Connect(function(track)
	local Material = Humanoid.FloorMaterial
	if track.Name == "WalkAnim" then
		track:GetMarkerReachedSignal("Step"):Connect(function()
		script.RemoteEvent:FireServer(character, Material)
		end)
	end
end)

Server Script

script.Parent.RemoteEvent.OnServerEvent:Connect(function(Material)
	if Material == Enum.Material.DiamondPlate then
		script.Parent.Step:Play()
	end
end)

it plays the footstep sound, but the sound ignores when it shoud play and just plays it, someone know how to fix?

this line is incorrect

script.Parent.RemoteEvent.OnServerEvent:Connect(function(Material)

The correct version is:

script.Parent.RemoteEvent.OnServerEvent:Connect(function(player,character, Material)
1 Like

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