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

Why is this script playing the sound in studio, and not in-game?

Asked by
nanaluk01 247 Moderation Voter
7 years ago
Edited 7 years ago

Why is this script playing the sound in studio, and not in-game?

It plays the sound whenever I touch the "Rupees" in studio, but not in-game, why?

Filtering Enabled is NOT on.

Everything in the script works, except it playing the sound.

There are zero errors.

My coding is as follows:

EDIT: There might be lines that are not "complete", but just view the code in "source mode" to see all of it.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        for i,v in pairs(game.Workspace:WaitForChild("GameGeometry"):WaitForChild("Rupees"):WaitForChild("Rupees"):GetChildren()) do
            v.Touched:connect(function(hit)
                --print("Got hit")
                local Configuration = v:FindFirstChild("Configuration")
                if Configuration then
                    --print("Found config")
                    if Configuration.CanCollect.Value == true then
                        --print("Can collect rupee")
                        local hum = hit.Parent:FindFirstChild("Humanoid")
                        if hum then
                            --print("Hit is a player")
                            local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
                            local PlrGui = plr:FindFirstChild("PlayerGui")
                            local RupeeSoundCollect = player.PlayerGui.RupeeSound
                            local leaderstats = plr:FindFirstChild("leaderstats")
                            if leaderstats then
                                --print("Found leaderstats")
                                local rupees = leaderstats:FindFirstChild("Rupees")
                                if rupees and RupeeSoundCollect then
                                    --print("Found rupees inside leaderstats")
                                    RupeeSoundCollect:Play()
                                    Configuration.CanCollect.Value = false
                                    v.Transparency = 1
                                    rupees.Value = (rupees.Value + v.RupeeValue:FindFirstChild("Value").Value)
                                end
                            end
                        end
                    end
                end
            end)
        end
    end)
end)

Any help is greatly appreciated!

1 answer

Log in to vote
-1
Answered by
Kenley67 -12
7 years ago

It's most likely a roblox bug

0
No, it's because he used the term "local". Difined_Person 61 — 7y
Ad

Answer this question