I'm trying to make my Food play a eating sound, which works. But it's only played Locally/ No one else can hear it. Any ideas how I can fix this?

I think it'd work with Remote Events but I'm not sure how to do that

Script Where Sound Is Played

local animations = {"4614299228"} -- put ur animation ids here
local CanAttack = true

script.Parent.Activated:connect(function()
	if CanAttack == true then
		CanAttack = false
	local animation = Instance.new("Animation",  script.Parent.Parent)
	animation.AnimationId = "http://www.roblox.com/asset?id="..animations[math.random(1, #animations)]
	local chosenanim = script.Parent.Parent.Humanoid:LoadAnimation(animation)
	chosenanim:Play()
	script.Parent.Chomp:Play()
	wait(.5)
	script.Parent.Handle.Transparency = 1
	wait(.5)
	script.Parent.Chomp:Stop()
	wait(1)
	script.Parent.Handle.Transparency = 0
	CanAttack = true
	end
end)

2 comments

1

You'll need to use remote events for this, as playing sounds locally will not replicated across all other clients. Take a look at this to learn about them; https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events Also, as a side note :connect() is deprecated, so use :Connect() instead

0

I know how to use remote events, but I have no idea how I would make the sound play!? Would I have to clone it to the players head, then play the sound when the event is fired?