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

Trying to run a sound from SoundScape via chat based on the player's rank in a group?

I'm working on a group raid game, and I want a certain rank and up in the group to be able to say :raidofficial and make the RaidOfficial sound play. Note that this works perfectly fine in studio, but not when you actually play the game. Alternatively, if anyone could assist in figuring out how to add a command like this to Basic Admin, that would be preferred as I tried that but couldn't. Feel free to PM me.

Anyway, here's the script.

function onChatted(msg, recipient, speaker) 
 

local source = string.lower(speaker.Name) 
msg = string.lower(msg) 
local rank=speaker:GetRankInGroup(1256948) -- group
if rank >= 8 then -- rank 8 and higher
	if (msg == ":raidofficial") then -- Sound I want to play
game.Soundscape.RaidOfficial:Play()
wait(58.174) -- Length of sound
game.Soundscape.RaidOfficial:Stop() 
end
end 

end 

function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered) 

1 answer

✓ Accepted answer

When testing a game in Studio, all scripts happen to run on your client. This is what makes the sound play, on your client.

I think that the problem occuring here is that sounds played in Soundscape can't be heard anywhere. Instead put the sound in workspace and play it from there.

1 comment

0

That fixed it, thanks!

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