can someone help, im trying to make it so, if you press F, a animation plays and an audio queue from the humanoid root part of the local player who pressed it. The problem is that when another player presses it, it cancels the previous’ persons audio and it plays for the person who pressed it. I dont know if its my remote event?I have a script that automatically sends the sound from repicated storage to the hrp so i dont think yall need that. Here are my 2 remaining scripts:
local script in startercharacterscript:
local UserInputService = game:GetService("UserInputService")
local animation = script:WaitForChild("Animation")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local animation = humanoid:LoadAnimation(animation)
local soundinhuman = character.HumanoidRootPart:WaitForChild("Sound")
local remote = game.ReplicatedStorage:WaitForChild("EmoteEvent")
UserInputService.InputBegan:Connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.F then
remote:FireServer()
animation:Play()
end
end)
script in server script service:
local Players = game:GetService("Players")
local EmoteEvent = game:GetService("ReplicatedStorage"):FindFirstChild("EmoteEvent")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
EmoteEvent.OnServerEvent:Connect(function()
local SoundtoPlay = Character:WaitForChild("HumanoidRootPart"):WaitForChild("Sound")
SoundtoPlay:Play()
end)
end)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.