Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Sound not playing?

A big mystery is going on in this script as the sound marked isn't playing, whilst the other one is playing, the funny thing is that there is no error in the output and neither in the Developer Console (F9) and it is working perfectly in studio but not in game/server.

Everything is working properly except for the sound part.

script.Parent.Touched:connect(function(hit)
	if DB == false and hit.Parent:FindFirstChild("Humanoid")~=nil then
		DB = true
		local character = hit.Parent
		local player = game.Players:GetPlayerFromCharacter(character)
		local leaderstats = player:FindFirstChild("leaderstats")
		if leaderstats.Value == false then
			leaderstats.Value = true
			script.Parent:WaitForChild("Good"):Play()-- NOT WORKING
			owner.Value = player.Name
			script.Parent:Destroy()
		else
			script.Parent:WaitForChild("Bad"):Play()--WORKING
		end
		wait(0.5)
		DB = false
	end
end)

1 answer

I noticed you were checking to see if 'leaderstats.Value == false'. If you are using a ROBLOX provided leaderboard, or most Free Model leaderboards, leaderstats is an IntValue. What you're doing, is attempting to compare it to a boolean value. If you're looking for a specific leaderstat, then you'll have to grab one of leaderstats's children.

1 comment

0

I made the leaderstats a bool value so I use the bool to check if the player owns a tycoon or not. :/

This discussion is preserved as it was. New answers, comments, and votes are closed.