SITUATION:
I have a rounds-based Roblox game and I have a mute button which I would like to have work when players are in the round. This code is from a script in serverscriptserver:
local roundzone = regionPart -- this is an invisible part surrounding the round that if a player touches I know they are in the round
playerinround = true
local roundsmusic = currentmap:FindFirstChild(chosenmap.Value).themesong -- different maps are cloned from server storage into a folder called currentmap
function inround(part)
local parent = part.Parent
if part.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player ~= nil then
--playerinround = true
roundsmusic.Volume = 0
--if roundsmusic.Volume == 1 then roundsmusic.Volume = 0 else roundsmusic.Volume = 1 end
end
end
return playerinround
end
game.StarterGui.Mute.TextButton.Touched:Connect(inround) -- runs function when the button is touched
PROBLEM:
When I run this I get an error that says: Touched is not a valid member of TextButton "StarterGui.Mute.TextButton"
Would love any advice!
I have a rounds-based Roblox game and I have a mute button which I would like to have work when players are in the round. This code is from a script in serverscriptserver:
local roundzone = regionPart -- this is an invisible part surrounding the round that if a player touches I know they are in the round
playerinround = true
local roundsmusic = currentmap:FindFirstChild(chosenmap.Value).themesong -- different maps are cloned from server storage into a folder called currentmap
function inround(part)
local parent = part.Parent
if part.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player ~= nil then
--playerinround = true
roundsmusic.Volume = 0
--if roundsmusic.Volume == 1 then roundsmusic.Volume = 0 else roundsmusic.Volume = 1 end
end
end
return playerinround
end
game.StarterGui.Mute.TextButton.Touched:Connect(inround) -- runs function when the button is touched
PROBLEM:
When I run this I get an error that says: Touched is not a valid member of TextButton "StarterGui.Mute.TextButton"
Would love any advice!