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

Error with textboxes filtering enabled?

Asked by 7 years ago

23:58:28.507 - Players.rubene45.PlayerGui.RadioGlobal.Frame.ID.Script:14: attempt to concatenate local 'ID' (a userdata value).

01local PonerMusica = game.Workspace.PonerMusicaGlobal
02local PararMusica = game.Workspace.PararMusicaGlobal
03local Texto = game.Workspace.PonerMusicaGlobal2
04Debug = 0
05 
06local function PonerMusicaGlobal()
07    if Debug == 0 then
08        Debug = 1
09        Audio = Instance.new("Sound")
10        Audio.Name = "Audio"
11        Audio.Parent = game.Workspace
12        Audio.Looped = true
13        local ID = script.Parent
14        Audio.SoundId = "rbxassetid://"..ID
15        Audio:Play()
View all 29 lines...
0
It is a server script! rubene45 2 — 7y

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
7 years ago
Edited 7 years ago

By looking at your script i'm guessing that the script's name, that this code is in, is the ID of a sound you want to use. If so the reason it's erroring is because you are trying to concatenate the script with the string, to make this we need to give it the script's name which is a string.

1local ID = script.Parent.Name
2Audio.SoundId = "rbxassetid://"..ID

Result:

01local PonerMusica = game.Workspace.PonerMusicaGlobal
02local PararMusica = game.Workspace.PararMusicaGlobal
03local Texto = game.Workspace.PonerMusicaGlobal2
04Debug = 0
05 
06local function PonerMusicaGlobal()
07    if Debug == 0 then
08        Debug = 1
09        Audio = Instance.new("Sound")
10        Audio.Name = "Audio"
11        Audio.Parent = game.Workspace
12        Audio.Looped = true
13        local ID = script.Parent.Name
14        Audio.SoundId = "rbxassetid://"..ID
15        Audio:Play()
View all 29 lines...
Ad

Answer this question