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

Why is :Play() not working in my touch script??

Asked by 5 years ago
Edited 5 years ago

code:

local event = game.ReplicatedStorage.Touch_Collect.RemoteEvent
local running = false
local sound = game.ReplicatedStorage.SoundMusic.sound
event.OnServerEvent:Connect(function(player)
    if not running then running = true
    local pieces = player.leaderstats:WaitForChild("Pieces")
local coins = player.leaderstats:WaitForChild("Coins")
wait(0.1)
local value = pieces.Value
coins.Value = coins.Value +value
pieces.Value = pieces.Value - value
sound:Play()
wait(5)
running = false
end
    end)

1 answer

Log in to vote
1
Answered by 5 years ago

I think you might use sound.Playing = true

0
Ok umm i put it in workspace and now its playing i juts changed the sound varible to workspace.sound. How would that work but it's not working when i put it in replicatedstrorage? Is it a glitch maybe? Freddan2006YT 88 — 5y
0
Maybe because your sound were in replicated storage, when something is in replicated storage it's not physically in your game I think so you couldn't hear the sound Louix27626 83 — 5y
0
Ok well i fixed it Freddan2006YT 88 — 5y
Ad

Answer this question