I made the player be able to choose its gender and i made 2 death sound scripts for that ( one for male, one for female, both have the same code) and i wanted to make it so if a button is pressed, a local script sets a boolvalue to true (the local script changes the bodytype of the player). The boolvalue gets set to true but the death sound script doesnt detect the boolvalue.
here is my code:
local value = game.ReplicatedStorage.Male
value.Value = false
if value.Value == true then
print("value true")
function Died(p)
wait(.001)
local tracks=script:GetChildren()
local rn=math.random(1,#tracks)
local track=tracks[rn]
if track~=nil then
track:play()
wait(8)
track:pause()
end
end
function Hum(p)
hum = p:findFirstChild("Humanoid")
if hum ~= nil then
hum.Died:connect(function(hum) Died(p) end)
end
end
function Enter(p)
p.CharacterAdded:connect(Hum)
end
game.Players.PlayerAdded:connect(Enter)
else
end
Thanks if you try to help.