I am trying to make a Custom ID system. When the ID is given to the server to play the ID, it outputs this error:
Attempt to concatenate string with Instance)
I tried different solutions but all has not worked. This is the localScript grabbing the ID and sending it to the server. (Not the entire script just the part where it sends the ID)
local function onFocusLost(enterPressed, inputObject) -- When the player presses ENTER, check for the ID otherwise cancel.
if enterPressed then
local CustomID = textBox.Text -- The users desired AudioID
CustomIDSet:FireServer(CustomID)
print(CustomID.." was attempted to be forced.")
textBox.Text = ""
else
-- The player stopped editing without pressing Enter
textBox.Text = "" -- Just clear
end
end
-- Call Function
textBox.FocusLost:Connect(onFocusLost)
This is the script taking that ID and converting it so it can load and play.
local function IDplayer(CustomID)
SpeakerA:Stop()
SpeakerA:Stop()
SpeakerA:Stop()
SpeakerA.TimePosition = 0
SpeakerB.TimePosition = 0
SpeakerC.TimePosition = 0
CustomIDServer = CustomID -- Set the ID to what was given from client.
SpeakerA.SoundId = "rbxassetid://"..CustomIDServer
SpeakerB.SoundId = "rbxassetid://"..CustomIDServer -- Convert the ID
SpeakerC.SoundId = "rbxassetid://"..CustomIDServer -- Convert the ID
SpeakerA:Play()
SpeakerB:Play()
SpeakerC:Play()
print("[Dev Console] A custom ID was forced. ID:"..CustomID) -- [Debug]
end
CustomIDSet.OnServerEvent:Connect(IDplayer)
