Ad
Log in to vote
0

How To Play a sound via a script ( not local?)

Asked by
hokyboy 270 Moderation Voter
1 year ago
local RepStorage = game:GetService("ReplicatedStorage")
local KGFolder = RepStorage:WaitForChild("KGRemoteEvents")
local ActivateRemote = KGFolder:WaitForChild("SharinganActivate")
local ServerStorage = game:GetService("ServerStorage")
local KGItemFolder = ServerStorage:WaitForChild("KG_Folder")
local SharinganFolder = KGItemFolder:WaitForChild("Sharingan")

local function ActivateSharingan(plr)
    if plr.KGStore.KGActive.Value == true then
        if plr.Character.Head:FindFirstChild("GenkaiDisplay") then 
            plr.Character.Head.GenkaiDisplay:Destroy()
            SharinganFolder.SFX.SharinganDictivated:Play()
            plr.KGStore.KGActive.Value = false
        end
    else
        SharinganFolder.Stuff.GenkaiDisplay:Clone().Parent = plr.Character.Head
        SharinganFolder.SFX.SharinganActivated:Play()
        plr.KGStore.KGActive.Value = true
    end
end

ActivateRemote.OnServerEvent:Connect(ActivateSharingan)
0
Please clarify your question. See http://idownvotedbecau.se/unclearquestion for more information TTChaos 750 — 1y
0
TTChaos bruh what MarcTheRubixQb 131 — 1y

2 answers

Log in to vote
0
Answered by 1 year ago

Get the Sound Object and do:

local sound = script.Sound
~~your event~~
sound:Play()
0
put a sound object inside your script and change SoundID for your wanted ID, and then use this example Ariirael 15 — 1y
0
Did it like u wanted does not work hokyboy 270 — 1y
0
This does work. TTChaos 750 — 1y
Ad
Log in to vote
0
Answered by 1 year ago

It depends where you sound is, what works for me is if you put the sound in workspace and put a server script in workspace and then write this in the script

local sound = game.Workspace["insert sound name in here"] --insert the sound name in the " "
sound:Play()

I hope this helps!

Answer this question