0

# How do I name a Folder something with code in it and stuff in ""?

So i made a script to make a folder in SoundService. Its erroring with

ServerScriptService.OnJoining.Script:7: attempt to call a string value>

Im pretty sure its something simple

The script is in ServerScriptService

local Players = game:GetService("Players")
local SoundService = game:GetService("SoundService")

local Folder = Instance.new("Folder")
Folder.Parent = SoundService
Folder.Name = plr.Name" Sounds"
end)



I tried searching if someone had the same problem as me, Im pretty sure there is one but just titled differently from what im looking up.

0
NGC4637 227
5 days ago

you had one tiny error. You forgot to add text wrapping when mixing strings together. what I mean is the ". ." in between plr.Name and " Sounds"

here is the fixed script in case you still don't know what I mean:

local Players = game:GetService("Players")
local SoundService = game:GetService("SoundService")

local Folder = Instance.new("Folder",SoundService) -- yes, you can set the parent in the instance function
Folder.Name = plr.Name.."'s Sounds" -- the line that errored which I fixed

0
Thankyou, Its always the small stuff i miss. KoalaTech 6 — 5d
0
Edited 5 days ago

In line 7, you didn't add concatenation, which is ".." used to connect strings. The game thinks you are calling a method because doing

plr.Name"Sounds"


is the same as doing

plr.Name("Sounds")


Instead you should use concatenation. This is an example

local a = "Hello"
local b = "World"

print(a..b) -- prints "HelloWorld". It connects "Hello" (a) with "World" (b)

print(a.." "..b) -- this prints "Hello World". It connects "Hello" (a) and then connects a space which makes the string into "Hello " and then connects it with "World" (b) which makes the string into "Hello World"


Here is your code with the correction

local Players = game:GetService("Players")
local SoundService = game:GetService("SoundService")