#Passing a string becomes an instance

1 messages · Page 1 of 1 (latest)

crude thorn
#

i have this in my server script:

    local name = username .. "'s Server"
    local newServer = serverTemplate:Clone()
    newServer.Username.Value = name
end

remoteEvent.OnServerEvent:Connect(addServer)```

and this is the local script that passes username:

```script.Parent.MouseButton1Click:Connect(function()
    local username = game.Players.LocalPlayer.Name
    remoteEvent:FireServer(username)
    
    if not remoteEvent then
        print("RemoteEvent not found on the client!")
        return
    end
end)```

why would i be getting the error `ServerScriptService.createLobbyScript:7: attempt to concatenate Instance with string  -  Server - createLobbyScript:7` when trying to do this?
#

also, if i do type(username) in the serverscript, it says "userdata" whereas in the local script itll be "string"

wise wind
#

maybe use the tostring() function

crude thorn
#

thanks that worked, i figured it would but why is it type userdata once its passed to the server? i feel like thats not expected behavior here

lament schooner