Server script doesnt detect boolvalue

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.

If you’re trying to read something on the server, which was changed on the client/local. Then the server can’t see it, you would need to use RemoteEvents to communicate with the server for the value to change on the server.

1 Like

my death sounds now work, thanks.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.