I want the sound to stay on the player when they respawn (Respawning is being replaced by a new Copy of an Instance in ServerStorage
As you can see in the video below, after the first respawn, the sound disconnects from the part it’s parented to and only plays in the spot where the player died.
I’ve tried reparenting the sound instance, deleting and making a new sound instance independently and parenting it to the player and (current) making a seperate part follow the player with the sound instance inside being replaced with every death.
Current setup:
Client Code:
-- Playing Bool
playing = false
-- Movement Sounds
rs:BindToRenderStep("rolling",10,function()
if dead == false then
if plrb.AssemblyLinearVelocity.Magnitude >= 10 then
if playing == false then
playing = true
rollingsound.rolling:Play()
end
rollingsound.rolling.PlaybackSpeed = plrb.AssemblyLinearVelocity.Magnitude/50
rollingsound.rolling.Volume = math.clamp(plrb.AssemblyLinearVelocity.Magnitude/100,0.1,3)
rollingsound.Position = plrb.Position
else
if playing == true then
playing = false
rollingsound.rolling:Stop()
end
end
end
end)
Sound gets removed on a death function. (reset, custom fall out of bounds, kill part)
Server Code:
function ballspawn(p)
local ball = game.ServerStorage.Baller:Clone()
local sound = game.ServerStorage.rollsound:Clone()
ball.Name = tostring(p.UserId)
ball.NameGUI.NameBox.Text = "<i>".."<b>"..p.DisplayName.."</b>".."</i>"
--print(p.Name)
ball.NameGUI.UserBox.Text = "<i>".."@"..p.Name.."</i>"
ball.Parent = workspace.Balls_
ball:SetNetworkOwner(p)
sound.Name = tostring(p.UserId)
sound.Parent = workspace.PlayerSounds_
game.ReplicatedStorage.BallerConnect:FireClient(p,ball,sound)
end
ballspawn gets called on PlayerAdded and on Death Event
Edit:
The Object containing the sound is still following the player as it should be.