Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
0
Answered by 8 years ago

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.

0
That fixed it, thanks! SHmods_arebad 0 — 8y
Ad

Answer this question