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

why cant a name a team (like literally)?

Asked by
chafava -113
4 years ago
Edited 4 years ago

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?

0
Line 4. Local script, type in name within () BashGuy10 384 — 4y
0
still no chafava -113 — 4y
0
Try Firing Name.Value if you are using a String val Fad99 286 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)

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. beeswithstingerss 41 — 4y
0
Ok so it does name the team now but the name is nothing chafava -113 — 4y
0
Are you sure the value of TextBox.Text isn't equal to nil then? beeswithstingerss 41 — 4y
0
yep im sure chafava -113 — 4y
View all comments (2 more)
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) beeswithstingerss 41 — 4y
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) beeswithstingerss 41 — 4y
Ad

Answer this question