Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why cant a name a team (like literally)?

script 1 (local script)

local name = script.Parent.Parent.TextBox.Text -- clan name

script.Parent.MouseButton1Down:Connect(function()
game.ReplicatedStorage.MakeClan:FireServer(name) -- putted in cos someone told me to :P
end)

script 2 (server script)

Remote = game.ReplicatedStorage.MakeClan

Remote.OnServerEvent:Connect(function(name)
	local clan = Instance.new("Team")
	clan.Parent = game:GetService("Teams")
	clan.Name = name -- .Name is not a string according to dev log
end)

you know the details, right?

3 comments

0

Line 4. Local script, type in name within ()

0

still no

0

Try Firing Name.Value if you are using a String val

1 answer

Name isn't set to anything. It can't get your "local" variable from a local script. To change this, inside your local script do this

local name = script.Parent.Parent.TextBox.Text -- clan name
 
script.Parent.MouseButton1Down:Connect(function()
game.ReplicatedStorage.MakeClan:FireServer(name)
end)

and for your server script this

Remote = game.ReplicatedStorage.MakeClan
	 
Remote.OnServerEvent:Connect(function(dwasd, name)
    local clan = Instance.new("Team")
    clan.Parent = game:GetService("Teams")
    clan.Name = name -- .Name is not a string according to dev log
end)

6 comments

0

The reason why the comment by BashGuy10 didn't work is because for some stupid reason, when passing a variable through remote events, you need to account for the first parameter of the receiver to be nil.

0

Ok so it does name the team now but the name is nothing

0

Are you sure the value of TextBox.Text isn't equal to nil then?

0

yep im sure

0

So in line 4 of the server script, press enter to start a new line so the local clan is on line 5. Then do print(name)

0

Also in line 4 of the local script, press enter so game.ReplicatedStorage... is on line 5, then do print(script.Parent.Parent.TextBox.Name)

This discussion is preserved as it was. New answers, comments, and votes are closed.