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

Lines of code that plays sound wont play the sound?

Asked by 4 years ago
Edited 4 years ago

So i have this code in a local script:

local replicatedstorage = game:GetService("ReplicatedStorage")
local standevent = replicatedstorage.Stand
local rot = stand:WaitForChild("StandHumanoidRootPart")


    local countsfx = rot.Count
    replicatedstorage.SndPlay:FireServer(countersfx)

There is more code then this but they dont mess with sound so i dont think its necessary to put them here.

The sound wont play for the Players OR the server/Other players, Help?

0
I've went through this once, not sure why it happens tbh. theConfusedHamster 2 — 4y
0
Does the sound get removed before playing? anshik1000 0 — 4y
0
No, it doesnt play at all but doesnt get removed. BrandonXYZ9 18 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

stand isn't a local. You need "Stand" as a local to go with whatever is here.

local rot = stand:WaitForChild("StandHumanoidRootPart")

Otherwise, here's your current script fixed:

-- add the "stand" local first
local rot = stand:WaitForChild("StandHumanoidRootPart")

        local countsfx = rot.Count
        game.ReplicatedStorage.SndPlay:FireServer(countsfx)
0
This doesnt work this only plays on the client and everyone else cant hear it. BrandonXYZ9 18 — 4y
Ad

Answer this question