Alright so basically I have these scripts with a remote event that allows the player to play an emote (an animation and an audio plays)
-
What is the issue? Include screenshots / videos if possible!
Whenever someone presses F, the player plays the emote and a audio but if a 2nd player presses F, it takes away the audio from the person who previously emoted. I want the audio to play for the player that presses it and does not override the previous.
Serverscriptservice script:
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)
User input script in StarterCharacterScripts:
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)
I have another script that automatically puts the sound in the humanoid root part. Ive tried searching for hours, can someone help?