I'm trying to get an "Eat" sound to be played, but it doesn't seem to work? Any ideas why?
Local Script
local animations = {"4614299228"} local CanAttack = true local Player = game:GetService'Players'.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Head = Character:FindFirstChild("Head") local throw= Instance.new("Sound",Head) throw.SoundId="rbxassetid://430285057" 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() throw:Play() wait(.5) script.Parent.Handle.Transparency = 1 wait(.5) throw:Stop() wait(1) script.Parent.Handle.Transparency = 0 CanAttack = true end end)
Try making another script and putting the sound stuff.
l local Head = Character:FindFirstChild("Head") local throw= Instance.new("Sound",Head) throw.SoundId="rbxassetid://430285057" script.Parent.Activated:connect(function() throw:Play() wait(.5) script.Parent.Handle.Transparency = 1 wait(.5) throw:Stop() wait(1) script.Parent.Handle.Transparency = 0 end end)
If that doesnt work, try making a sound and putting the soundid in it and just play it in the script. instead of making a new sound.