Still have questions? Join our Discord server and get real time help.
0

# Local ambience script fails to cooperate after the player dies and respawns?

while true do
wait(.25)
part = workspace:FindPartOnRayWithWhitelist(ray,whitelist,false)
AudioData = script:WaitForChild("AudioData")

if part ~= nil then
ray2 = Ray.new(part.Position,Vector3.new(0,1,0).unit*5000)


The problem seems to lie in the ray variable. When the player dies and respawns, it stops updating the player's head's position. I need to figure out how to get it to continue updating so the script continues to cooperate. Probably an easy fix, but I'm still in new territory for myself.

0

Never mind, I fixed it. "Char" was defined as "workspace.WaitForChild(Plr.Name)", which for a reason I have yet to fully understand was causing the issue. I changed it to the following:

This seemed to fix the problem completely. If anyone wants to help me understand what was going on with these two, I'd love to understand why my trial and error fixed it.