im getting this errorServerScriptService.award:6: attempt to concatenate local 'awardd' (a nil value)
im trying to make a thing where u put text in textboxes then when u press submit ur text comes up on a surface gui
heres my code
client::
local remote = game.ReplicatedStorage.award script.Parent.MouseButton1Click:Connect(function() remote:FireServer(script.Parent.Parent.Name.Text, script.Parent.Parent.Award.Text) end)
server:
local remote = game.ReplicatedStorage.award remote.OnServerEvent:Connect(function(player, awardd) game.Workspace.Screen.MainScreen.SurfaceGui.StartPage.Visible = false game.Workspace.Screen.MainScreen.SurfaceGui.Award.Visible = true game.Workspace.Screen.MainScreen.SurfaceGui.Award.TextLabel.Text = "Congratulations, "..player.." you have won the "..awardd print(player, awardd) end)
I have rewritten your code for you and updated it a little bit the problem was since you called the TextBox 'Name' it was bugging out and also you needed 3 arguments in the server script which you only put two here is the updated code!
Client
--LocalScript local Remote = game:GetService('ReplicatedStorage'):WaitForChild('award') function ButtonPress () Remote:FireServer(script.Parent.Parent.PlayerName.Text,script.Parent.Parent.Award.Text) end script.Parent.MouseButton1Click:Connect(ButtonPress)
Server
--ServerScript local Remote = game:GetService('ReplicatedStorage'):WaitForChild('award') function Reward(Player,Name,awardd) game.Workspace.Screen.MainScreen.SurfaceGui.StartPage.Visible = false game.Workspace.Screen.MainScreen.SurfaceGui.Award.Visible = true game.Workspace.Screen.MainScreen.SurfaceGui.Award.TextLabel.Text = "Congratulations, "..Name.." you have won the "..awardd end Remote.OnServerEvent:Connect(Reward)
remove one d in rewardd, you connected reward but you use rewardd
When you fire a remoteevent to the server, it carries the client it was fired from with it. For instance.
:FireServer()
OnServerEvent:Connect(function(player)
On the server script, player is a player instance, and awardd is the players name. You're getting the error because you're trying to concatenate a player object with a string. Use the following code in your server script:
local remote = game.ReplicatedStorage.award remote.OnServerEvent:Connect(function(plr, player, awardd) game.Workspace.Screen.MainScreen.SurfaceGui.StartPage.Visible = false game.Workspace.Screen.MainScreen.SurfaceGui.Award.Visible = true game.Workspace.Screen.MainScreen.SurfaceGui.Award.TextLabel.Text = "Congratulations, "..player.." you have won the "..awardd print(player, awardd) end)