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 comment
No, it's because he used the term "local".