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

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

Asked by
hokyboy 270 Moderation Voter
3 years 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 User#30567 0 — 3y
0
TTChaos bruh what MarcTheRubixQb 153 — 3y

2 answers

Log in to vote
0
Answered by 3 years 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 — 3y
0
Did it like u wanted does not work hokyboy 270 — 3y
0
This does work. User#30567 0 — 3y
Ad
Log in to vote
0
Answered by 3 years 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